Issue
Here's my tiny script to run celeryd:
#!/bin/bash -x
LOG=/home/var/log/ingest.log
sudo -u apache bash -c "nohup `pwd`/bin/django celeryd --purge --beat --loglevel=INFO >> $LOG &"
I run the script as a normal user, and enter the root password when requested.
I'd really like to see no output at all - everything sent to the log. Instead I'm seeing everything doubled:
[2012-03-19 19:54:38,987: INFO/PoolWorker-2] Received feed. 0 new entries out of 3 to process.
[2012-03-19 19:54:38,987: INFO/PoolWorker-2] Received feed. 0 new entries out of 3 to process.
[2012-03-19 19:54:38,988: INFO/MainProcess] Task atom_ingest.walk_feed[64d8e6c7-2ab4-4082-9d67-a8ecca9a4f7a] succeeded in 1.85489702225s: None
[2012-03-19 19:54:38,988: INFO/MainProcess] Task atom_ingest.walk_feed[64d8e6c7-2ab4-4082-9d67-a8ecca9a4f7a] succeeded in 1.85489702225s: None
[2012-03-19 19:55:32,083: INFO/Beat] Scheduler: Sending due task atom_ingest.walk_feeds
[2012-03-19 19:55:32,083: INFO/Beat] Scheduler: Sending due task atom_ingest.walk_feeds
[2012-03-19 19:55:32,285: INFO/MainProcess] Got task from broker: atom_ingest.walk_feeds[e65ddc54-23a5-46a0-86df-92479f79655b]
[2012-03-19 19:55:32,285: INFO/MainProcess] Got task from broker: atom_ingest.walk_feeds[e65ddc54-23a5-46a0-86df-92479f79655b]
This output is all coming from "the background", which means it spews all over my terminal when I'm doing other stuff.
I'm not really sure if my mistake is in my understanding of bash, celeryd, nohup, ...?
Solution
You can tell celeryd to log to a file with the option -f
.
You will still get some output. celeryd seems to ignore any attempts to redirect with output 2>&1 > /your/file/
.
P.S: I would suggest looking into something like Supervisor to manage your processes.
Answered By - Daniel Hepper Answer Checked By - David Goodson (WPSolving Volunteer)