Created
April 10, 2014 01:55
-
-
Save beppu/10336579 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh | |
set -e | |
NAME=ip_monster | |
PIDFILE=/var/run/$NAME.pid | |
LOG="/var/log/$NAME.log" | |
# This is the command to be run; give the full pathname. | |
DAEMON=/opt/ips/amqp-config-worker | |
# This is for testing to see if we even get messages from RabbitMQ. | |
DAEMON_OPTS="--route 'config.`hostname -s`" | |
# This is the real way to run amqp-config-worker and ip_monster.pl together. | |
#DAEMON_OPTS="--command /opt/ips/ip_monster.pl --route 'config.`hostname -s`" | |
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" | |
export NODE_ENV="production" | |
export ICE_AMQP_URL="amqp://rabbit.instantchannelinc.com:5672" | |
case "$1" in | |
start) | |
echo -n "Starting daemon: "$NAME | |
start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE --background --exec /bin/bash -- -c "$DAEMON $DAEMON_OPTS > $LOG 2>&1" | |
echo "." | |
;; | |
stop) | |
echo -n "Stopping daemon: "$NAME | |
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE | |
echo "." | |
;; | |
restart) | |
echo -n "Restarting daemon: "$NAME | |
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE | |
start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE --background --exec /bin/bash -- -c "$DAEMON $DAEMON_OPTS > $LOG 2>&1" | |
echo "." | |
;; | |
*) | |
echo "Usage: "$1" {start|stop|restart}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment