[Summary, full note in Shaarli]
Init script (/etc/init.d/carbon-cache) for Graphite's carbon-cache daemon, by Jeremy Chalmer, written for Ubuntu 11.10 with start-stop-daemon.
- LSB header: Provides carbon-cache, Required-Start/Stop $remote_fs $syslog, Default-Start 2 3 4 5, Default-Stop 0 1 6.
- Enable with: update-rc.d carbon-cache defaults
- Set USER in /opt/graphite/conf/carbon.conf to the owner of /opt/graphite/storage/: carbon-cache runs as that user.
- GRAPHITE_HOME=/opt/graphite, DAEMON=$GRAPHITE_HOME/bin/carbon-cache.py, hard-coded PIDFILE=/opt/graphite/storage/carbon-cache-a.pid (adapt if several carbon-cache instances run). Exits 99 if the daemon isn't executable. Carbon logs in /opt/graphite/storage/log/carbon-cache-*.
- do_start: start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON --test -- start (already running = 1), then the real start (failure = 2).
- do_stop: start-stop-daemon --stop --signal 2 --retry 5 --quiet --pidfile $PIDFILE, then remove the PID file.
- Actions: start, stop, restart (stop then start), status (kill -0 on the PID from the PID file); otherwise usage {start|stop|restart|status}, exit 3.