0

pardon me as this is my first time attempting to write a init script for centos 5.

I am using django + supervisor to manage my celery workers, scheduler.

Now, this is my naive simple attempt /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

inside my 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

I couldn't get it to work.

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

I believe it is the init script, but please help me understand what is wrong.

amateur
  • 123
  • 4

1 Answers1

1

There is a document that covers exactly what you need; It's would be very best for you to go over, it's conveniently located at following location:

[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 ~]$ 

but just for starters, it seems like at very least you're missing start() and stop() sub functions (that allows you to start or stop service).

OR you can try following: User-contributed OS init scripts for Supervisor - Supervisor/initscripts · GitHub

alexus
  • 12,342
  • 27
  • 115
  • 173
  • no rep to comment, to clarify - the issue is that the "python manage.py celeryd" process dies when run under supervisor (but works fine in the shell). There is no feedback from the command besides what's in the supervisord.log - child process died to quickly. Supervisord itself works and I do have the init scripts in place. Here is one of the files in the `/etc/supervisor/conf.d/celery.conf` [program:celery] command= python /srv/myapp/manage.py celeryd environment=PATH=/srv/myapp/env/bin/ user=apache numprocs=1 stdout_logfile=/var/log/supervisor/celery.log stderr_logfile=/var/log/super – Evgeny May 28 '14 at 20:56
  • easiest route to take is to use `User-contributed OS init scripts for Supervisor` - https://github.com/Supervisor/initscripts – alexus May 28 '14 at 21:28
  • Thanks, that I have already, i.e. supervisord starts with the `service` command. Let me update with my supervisord program config. – Evgeny May 28 '14 at 21:30
  • your supervisor and init script are two different things, as you mention yourself that supervisor itself works fine it's init script that you and `amateur` having issues with, try using user contributed init script, this will address your issue. – alexus May 28 '14 at 21:41
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://serverfault.com/help/whats-reputation) you will be able to [comment on any post](http://serverfault.com/help/privileges/comment). – HopelessN00b May 28 '14 at 21:54
  • @HopelessN00bGeniusofnetwork The question is not mine. I've added bounty on the question and lost ability to comment on other people's posts. – Evgeny May 28 '14 at 21:56
  • @Evgeny You can try change `user=apache` for `user=root` in `/etc/supervisor/conf.d/celery.conf` to check if it is a perms problem. – Droga Mleczna Jun 03 '14 at 13:00