I'm trying to redirect the stdout
and stderr
of command php artisan queue:work
while it's in background.
To accomplish this, I've created this script :
## script name: queue_work.sh #!/bin/bash ## Redirect Files STDOUTFILE="${RootDir}/storage/logs/queue_output" STDERRFILE="${RootDir}/storage/logs/queue_error" ## Run php artisan php ${ARTISANCMD} queue:work --queue=high --sleep=3 --tries=3 1>"${STDOUTFILE}_high.log" 2>"${STDERRFILE}_high.log" & php ${ARTISANCMD} queue:work --queue=low --sleep=3 --tries=3 1>"${STDOUTFILE}_low.log" 2>"${STDERRFILE}_low.log" &
When I run
./queue_work.sh
the four files are well created into storage/logs/
and when I process Queueable
the queue works well (that is process the commands) all queue_output*.log
and queue_error*.log
files stay empty.
What doesn't work in my simple script?
Thanks
Try running
nohup php artisan queue:work
it will create nohup.out file where all the output and errors will be displayed like:
[2017-03-24 00:00:00] Processed: App\Jobs\SomeJob