Skip to content

Instantly share code, notes, and snippets.

@Qs-F
Created October 31, 2015 14:28
Show Gist options
  • Save Qs-F/7c5c00d7617d39fd064e to your computer and use it in GitHub Desktop.
Save Qs-F/7c5c00d7617d39fd064e to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# chkconfig: 2345 86 16
# descripton: go web server
# processname: gowebserver
# pidfile: none
# config: none
#
# source function library
. /etc/rc.d/init.d/functions
PATH=$PATH:/usr/local/gowebserver
PROG=/usr/local/gowebserver/gowebserver
PROGNAME=`basename $PROG`
[ -f $PROG ] || exit 0
case "$1" in
start)
echo -n $"Starting $PROGNAME: "
daemon $PROG
echo
;;
stop)
echo -n $"Stopping $PROGNAME:"
killproc $PROGNAME
echo
;;
status)
status $PROGNAME
;;
restart)
echo -n $"Stopping $PROGNAME:"
killproc $PROGNAME
echo
echo -n $"Starting $PROGNAME: "
daemon $PROG
echo
;;
*)
echo $"Usage: $PROGNAME {start|stop|status|restart}" >&2
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment