mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-24 07:28:27 +00:00
sysinit script done
This commit is contained in:
parent
9d50fda5a1
commit
e3d66e96ce
40
tools/arkdaemon
Normal file → Executable file
40
tools/arkdaemon
Normal file → Executable file
@ -9,21 +9,15 @@
|
|||||||
#
|
#
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
# NOTICE: this daemon can work only if your system supports start-stop-daemon
|
|
||||||
|
|
||||||
# Using the lsb functions to perform the operations.
|
# Using the lsb functions to perform the operations.
|
||||||
. /lib/lsb/init-functions
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
# Global variables
|
# Global variables
|
||||||
source /etc/arkdaemon.cfg
|
source /etc/arkmanager/arkmanager.cfg
|
||||||
source /home/${steamuser}/.arkmanager.cfg
|
|
||||||
|
|
||||||
NAME=arkmanager_daemon
|
NAME="ShooterGameServer"
|
||||||
DESC="ARK manager daemon used to start the server and keep it updated"
|
|
||||||
PIDFILE="/var/run/${NAME}.pid"
|
|
||||||
LOGFILE="${logdir}/${NAME}.log"
|
LOGFILE="${logdir}/${NAME}.log"
|
||||||
DAEMON="arkmanager"
|
DAEMON="/usr/bin/arkmanager"
|
||||||
START_OPTS="--pidfile ${PIDFILE} --user=${steamuser} ${DAEMON}"
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@ -33,7 +27,9 @@ test -x $DAEMON || exit 5
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
log_daemon_msg "Starting" "$NAME"
|
log_daemon_msg "Starting" "$NAME"
|
||||||
if start-stop-daemon -b --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON ; then
|
sudo -u $steamcmd_user $DAEMON start
|
||||||
|
PID=`ps -ef | grep $NAME | grep -v grep | awk '{print $2}'`
|
||||||
|
if [ -n "$PID" ]; then
|
||||||
log_end_msg 0
|
log_end_msg 0
|
||||||
else
|
else
|
||||||
log_end_msg 1
|
log_end_msg 1
|
||||||
@ -42,28 +38,26 @@ case "$1" in
|
|||||||
|
|
||||||
stop)
|
stop)
|
||||||
log_daemon_msg "Stopping" "$NAME"
|
log_daemon_msg "Stopping" "$NAME"
|
||||||
kill ${cat $PIDFILE}
|
sudo -u $steamcmd_user $DAEMON stop
|
||||||
echo "$NAME."
|
PID=`ps -ef | grep $NAME | grep -v grep | awk '{print $2}'`
|
||||||
rm -f $PIDFILE
|
if [ -n "$PID" ]; then
|
||||||
|
log_end_msg 1
|
||||||
|
else
|
||||||
|
log_end_msg 0
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
restart|force-reload)
|
restart)
|
||||||
$0 stop && sleep 2 && $0 start
|
sudo -u $steamcmd_user $DAEMON restart
|
||||||
;;
|
;;
|
||||||
|
|
||||||
status)
|
status)
|
||||||
# Check the status of the process.
|
sudo -u $steamcmd_user $DAEMON status
|
||||||
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.
|
# For invalid arguments, print the usage message.
|
||||||
echo "Usage: $0 {start|stop|restart|status|force-reload}"
|
echo "Usage: $0 {start|stop|restart|status}"
|
||||||
exit 2
|
exit 2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user