Skip to content

Instantly share code, notes, and snippets.

@upa
Created September 25, 2012 16:13
Show Gist options
  • Save upa/3782867 to your computer and use it in GitHub Desktop.
Save upa/3782867 to your computer and use it in GitHub Desktop.
lispd of lispmob start/stop script
#!/bin/sh
# Start/Stop the lispd of lispmob daemon.
#
NAME=lispd
DAEMON=/usr/local/sbin/lispd
CONFIG=/etc/lispd.conf
PIDFILE=/var/run/lispd.pid
if [ ! -x $DAEMON ]; then
echo "$DAEMON does not exist"
exit 0
fi
if [ ! -e $CONFIG ]; then
echo "$CONFIG does not exist"
exit 0
fi
if [ `id -u` != "0" ]; then
echo "please run as a root"
exit 0
fi
start()
{
if [ -e $PIDFILE ]; then
echo "pid file ($PIDFILE) exists"
exit 0
fi
echo start $NAME
$DAEMON -f $CONFIG > /dev/null 2>&1 &
echo $! > $PIDFILE
}
stop()
{
if [ -e $PIDFILE ]; then
echo stop $NAME
kill `cat $PIDFILE`
rm $PIDFILE
else
echo "not running?"
exit 0
fi
}
restart ()
{
stop
start
}
case $1 in
start) start ;;
stop) stop ;;
restart) restart ;;
*) echo "$0 [start|stop]" ;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment