But there's a problem with this script. if I invoke it:
sudo service celeryd start
then I need to hit enter to get a shell prompt after it completes. This is a problem because I want to invoke it via ssh from another machine by doing:
ssh 192.168.2.3 sudo service celeryd start
and ssh never returns. (I use fabric to start and stop remote services, and this hangs it because it invokes the ssh command above).
What would cause this behavior, and how do I fix it in my script?
Note that if I do "sh -x /etc/init.d/celeryd" as recommended by Thomas Themel in the comments, the output is:
runuser -s /bin/bash - apache -c 'ulimit -S -c 0 >/dev/null 2>&1 ; /usr/local/django/portalapps/manage.py celeryd --pidfile /var/run/celery.pid -f /var/log/celeryd.log -l INFO'
I don't understand how the daemon function in /etc/init.d/functions (which is what produces this series of bash commands) actually daemonizes the process.