Yes, please do, as it's likely much better than this one I wrote:
#!/bin/sh
#
#
#
#
# chkconfig: 345 80 05
# description:
#init script for paste script celeryd, which was written by
#branded on freenode
#mbrownnyc everywhere else
#hacky init.d script for celeryd paste script
#
### BEGIN INIT INFO
# Provides: paste-script-celeryd
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Description: Paste Script to launch celeryd reading config out
of a paste config file
### END INIT INFO
case "$1" in
start)
if [ ! -f /var/run/celeryd.pid ]; then #process isn't running
probably
echo Attempting to start celeryd paste script...
forking it up with \&
export HOME=/root #well... yea, this has to do with
previous steps, I'll have to review how to modify this so it's less
horrible.
/var/www/rhodecode-venv/bin/paster celeryd /var/www/
rhodecode/production.ini --pidfile=/var/run/celeryd.pid -f /var/log/
celerydpaster.log -l WARNING -q &
echo Done.
else
echo The celeryd paste script has filed a paste PID $
(cat /var/run/celeryd.pid)
echo It\'s likely started already at that PID.
fi
;;
stop)
if [ -f /var/run/celeryd.pid ]; then #process is running
probably
echo sending SIGINT to the process $(cat /var/run/
celeryd.pid) to trigger a "Warm shutdown"
pypastceleryPID=$(cat /var/run/celeryd.pid)
kill -SIGINT $pypastceleryPID
echo Waiting for process to die...
#umm... yea!
http://stackoverflow.com/questions/696839/how-do-i-write-a-bash-script-to-restart-a-process-if-it-dies
while [ -f /var/run/celeryd.pid ]; do sleep 1; done
echo Truncating /var/log/celerydpaster.log to entries
from last run only.
sed -i '1,'$(expr $(grep -n -e "^----\s\*\*\*\*
\s-----" /var/log/celerydpaster.log | cut -d':' -f1 | awk '$1 > max
{ max=$1 }; END { print max }') - 1)'d' /var/log/celerydpaster.log
else
echo /var/run/celeryd.pid doesn\'t exist, so the
celeryd paste script was not used to execute celeryd if celeryd is
actually running.
echo Otherwise it isn\'t running.
fi
;;
restart)
stop
start
;;
status)
if [ -f /var/rrun/celeryd.pid ]; then
echo celeryd paste script is running as PID $(cat /var/
run/celeryd.pid)
tail -n 20 /var/log/celerydpaster.log
else
echo celeryd paste script isn\'t running.
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
;;
esac
exit 1
On Oct 28, 8:17 am, lance dillon <
riffraff...@gmail.com> wrote:
> I created a init script to do that, I can post it if you want.
>
>
>
>
>
>
>
> On Tue, Oct 25, 2011 at 11:31 AM, mbrownnyc <
matthewbr...@gmail.com> wrote:
> > Hello,
>
> > How do I daemonize the paster celeryd process?
>
> > It seems that notes mentioned inhttps://
github.com/ask/celery/issues/373