Skip to content

Instantly share code, notes, and snippets.

@sdvcrx
Created January 19, 2014 13:02
Show Gist options
  • Save sdvcrx/8504670 to your computer and use it in GitHub Desktop.
Save sdvcrx/8504670 to your computer and use it in GitHub Desktop.
start script for popobox
#!/bin/sh
NAME=aria2c
prefix="/usr"
DAEMON=${prefix}/bin/${NAME}
DAEMON_OPTS="-D"
test -x $DAEMON || exit 0
if [ -z "$1" ] ; then
case `echo "$0" | sed 's:^.*/\(.*\):\1:g'` in
S??*) rc="start" ;;
K??*) rc="stop" ;;
*) rc="usage" ;;
esac
else
rc="$1"
fi
case "$rc" in
start)
echo "Starting $NAME"
$DAEMON $DAEMON_OPTS
;;
stop)
if [ -n "`pidof $NAME`" ]; then
echo "Stop $NAME"
kill `pidof $NAME` 2> /dev/null
fi
;;
restart)
"$0" stop
sleep 1
"$0" start
;;
status)
if [ -n "`pidof $NAME`" ]; then
echo "$NAME is running"
else
echo "$NAME is not running"
fi
;;
*)
echo "Usage: $0 (start|stop|restart|status|usage)"
;;
esac
exit 0
#!/bin/sh
prefix="/opt"
PATH=${prefix}/bin:${prefix}/sbin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=lighttpd
DAEMON=${prefix}/sbin/${NAME}
DAEMON_OPTS="-f ${prefix}/etc/lighttpd/lighttpd.conf"
test -x $DAEMON || exit 0
if [ -z "$1" ] ; then
case `echo "$0" | sed 's:^.*/\(.*\):\1:g'` in
S??*) rc="start" ;;
K??*) rc="stop" ;;
*) rc="usage" ;;
esac
else
rc="$1"
fi
case "$rc" in
start)
echo "Starting web server: $NAME"
$DAEMON $DAEMON_OPTS
;;
stop)
if [ -n "`pidof $NAME`" ]; then
echo "Stopping web server: $NAME"
killall $NAME 2> /dev/null
fi
;;
restart)
"$0" stop
sleep 1
"$0" start
;;
status)
if [ -n "`pidof $NAME`" ]; then
echo "$NAME is running"
else
echo "$NAME is not running"
fi
;;
*)
echo "Usage: $0 (start|stop|restart|status|usage)"
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment