Skip to content

Instantly share code, notes, and snippets.

@hvergara
Created January 27, 2012 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hvergara/1690368 to your computer and use it in GitHub Desktop.
Save hvergara/1690368 to your computer and use it in GitHub Desktop.
generic init.d script
#! /bin/sh
###
# chkconfig: 235 98 55
# description: Your service
###
NAME="your service name"
DAEMON=/usr/bin/service
PIDFILE=/var/run/service.pid
case "$1" in
start)
echo -n "Starting $NAME: "
$DAEMON --pidfile $PIDFILE
echo "OK"
;;
stop)
echo -n "Stopping $NAME: "
kill -9 `cat $PIDFILE` && rm -f $PIDFILE
echo "OK"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {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