原谅我,因为这是我第一次尝试为centos 5写一个init脚本。
我正在使用django +主pipe来pipe理我的芹菜工作者,调度员。
现在,这是我天真简单的尝试/etc/init.d/supervisor
#!/bin/sh # # /etc/rc.d/init.d/supervisord # # Supervisor is a client/server system that # allows its users to monitor and control a # number of processes on UNIX-like operating # systems. # # chkconfig: - 64 36 # description: Supervisor Server # processname: supervisord # Source init functions /home/foo/virtualenv/property_env/bin/python /home/foo/bar/manage.py supervisor --daemonize
在我的supervisor.conf里面:
[program:celerybeat] command=/home/property/virtualenv/property_env/bin/python manage.py celerybeat --loglevel=INFO --logfile=/home/property/property_buyer/logfiles/celerybeat.log [program:celeryd] command=/home/foo/virtualenv/property_env/bin/python manage.py celeryd --loglevel=DEBUG --logfile=/home/foo/bar/logfiles/celeryd.log --concurrency=1 -E [program:celerycam] command=/home/foo/virtualenv/property_env/bin/python manage.py celerycam
我无法得到它的工作。
2013-08-06 00:21:03,108 INFO exited: celerybeat (exit status 2; not expected) 2013-08-06 00:21:06,114 INFO spawned: 'celeryd' with pid 11772 2013-08-06 00:21:06,116 INFO spawned: 'celerycam' with pid 11773 2013-08-06 00:21:06,119 INFO spawned: 'celerybeat' with pid 11774 2013-08-06 00:21:06,146 INFO exited: celerycam (exit status 2; not expected) 2013-08-06 00:21:06,147 INFO gave up: celerycam entered FATAL state, too many start retries too quickly 2013-08-06 00:21:06,147 INFO exited: celeryd (exit status 2; not expected) 2013-08-06 00:21:06,152 INFO gave up: celeryd entered FATAL state, too many start retries too quickly 2013-08-06 00:21:06,152 INFO exited: celerybeat (exit status 2; not expected) 2013-08-06 00:21:07,153 INFO gave up: celerybeat entered FATAL state, too many start retries too quickly
我相信这是初始化脚本,但请帮助我了解什么是错的。
有一个文件,涵盖了你所需要的; 这将是最好的,你去,它位于以下位置方便:
[alexus@wcmisdlin02 ~]$ ll /usr/share/doc/initscripts-*/ total 92 -rw-r--r--. 1 root root 1996 Oct 10 2013 changes.ipv6 -rw-r--r--. 1 root root 18013 Oct 10 2013 COPYING -rw-r--r--. 1 root root 5112 Oct 10 2013 ipv6-6to4.howto -rw-r--r--. 1 root root 2880 Oct 10 2013 ipv6-tunnel.howto -rw-r--r--. 1 root root 1198 Oct 10 2013 README-init -rw-r--r--. 1 root root 708 Oct 10 2013 static-routes-ipv6 -rw-r--r--. 1 root root 38931 Oct 10 2013 sysconfig.txt -rw-r--r--. 1 root root 6357 Oct 10 2013 sysvinitfiles [alexus@wcmisdlin02 ~]$
但是对于初学者来说,似乎至less缺less了start()和stop()子函数(它允许你启动或停止服务)。
或者您可以尝试以下内容:Supervisor – Supervisor / initscripts的用户提供的操作系统初始化脚本·GitHub