### BEGIN INIT INFO # Provides: ARK manager deamon # Required-Start: networking # Required-Stop: networking # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: ARK manager deamon # Description: ARK manager daemon used to start the server and keep it updated # ### END INIT INFO # Using the lsb functions to perform the operations. . /lib/lsb/init-functions # Global variables source /etc/arkdaemon.cfg source /home/${steamuser}/.arkmanager.cfg NAME=arkmanager_daemon DESC="ARK manager daemon used to start the server and keep it updated" PIDFILE="/var/run/${NAME}.pid" LOGFILE="${logdir}/${NAME}.log" DAEMON="arkmanager" START_OPTS="--pidfile ${PIDFILE} --user=${steamuser} ${DAEMON}" set -e # If the daemon is not there, then exit. test -x $DAEMON || exit 5 case "$1" in start) log_daemon_msg "Starting" "$NAME" if start-stop-daemon -b --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON ; then log_end_msg 0 else log_end_msg 1 fi ;; stop) log_daemon_msg "Stopping" "$NAME" kill ${cat $PIDFILE} echo "$NAME." rm -f $PIDFILE ;; restart|force-reload) $0 stop && sleep 2 && $0 start ;; status) # Check the status of the process. PID=`ps -ef | grep $DAEMON | grep -v grep | awk '{print $2}'` if [ -n "$PID" ]; then echo "$NAME is running on PID $PID" else echo "$NAME is not running" fi ;; *) # For invalid arguments, print the usage message. echo "Usage: $0 {start|stop|restart|status|force-reload}" exit 2 ;; esac exit 0