我的主管日志是空的,我不知道该怎么做才能填充它。我有一个简单的测试bash脚本
#!/usr/bin/env bash
echo "STARTING SCRIPT"
while read LINE
do
echo ${LINE} 2>&1
done < "${1:-/dev/stdin}"
exit 0
还有我的supervisor.conf
[unix_http_server]
file=/tmp/supervisor.sock
[supervisord]
logfile=/var/log/supervisor/supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
loglevel=info
pidfile=/var/run/supervisord.pid
nodaemon=false
minfds=1024
minprocs=200
umask=022
nocleanup=false
[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
[program:print-lines]
command=gearman -h 127.0.0.1 -p 4730 -w -f print-lines -- /var/www/html/myapp/bash/printlines.sh 2>&1
process_name=print-lines-worker
numprocs=1
startsecs = 0
autorestart = false
startretries = 1
user=root
stdout_logfile=/var/www/html/myapp/var/log/supervisor_print_lines_out.log
stdout_logfile_maxbytes=10MB
stderr_logfile=/var/www/html/myapp/var/log/supervisor_print_lines_err.log
stderr_logfile_maxbytes=10MB
然后我通过php脚本执行这个工作
$gmClient= new GearmanClient();
$gmClient->addServer();
# run reverse client in the background
$jobHandle = $gmClient->doBackground("print-lines", $domains);
var_dump($jobHandle);
那么接下来会发生什么。工作得到执行
myapp-dev: /var/www/html/myapp $ gearadmin --status
print-lines 1 1 1
但是这两个日志文件都是空的...我至少会期望某个地方会写“STARTING SCRIPT”或者什么,但是一切都是空的。
我究竟做错了什么?我检查错误的日志文件?
如果您需要任何其他信息,请告诉我,我会提供。谢谢
我找到了解决方案或者至少有一种解决方法。我做的是跟随
我的supervisor.conf命令现在看起来像这样
command=gearman -h 127.0.0.1 -p 4730 -w -f print-lines -- bash -c "/var/www/html/myApp/bash/printlines.sh > /var/www/html/myApp/var/log/printlines.log 2>&1"
因此shell在执行shell脚本时正在编写日志文件