Changeset 9 for scripts/etc/init.d/7dtd.sh
- Timestamp:
- May 15, 2014, 8:38:37 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/etc/init.d/7dtd.sh
r7 r9 13 13 ### END INIT INFO 14 14 15 . /etc/7dtd.conf 16 17 NAME="7DtD" 18 BINARYPATH=$SDTD_ROOT 19 USER=$SDTD_USER 20 RUNTIME=$WINE 21 BINARYNAME=7DaysToDie.exe 22 PIDFILE="7dtd-server.pid" 23 24 OPTS="-quit -batchmode -nographics -configfile=../serverconfig.xml -dedicated" 25 26 cd "$BINARYPATH" 15 . /usr/local/bin/7dtd-common.sh 16 checkRootLoadConf 27 17 28 18 case "$1" in 29 19 start) 30 echo -n "Starting the $NAME server... " 31 if [ ! `pgrep Xvfb` ]; then 32 su -c "/usr/bin/Xvfb :1 -screen 0 640x480x16" sdtd & 33 sleep 3 34 fi 35 if [ -e "$BINARYNAME" ]; then 36 if [ `pgrep $BINARYNAME` ]; then 37 echo "Already running!" 38 else 39 export DISPLAY=localhost:1.0 40 start-stop-daemon --start --pidfile $SDTD_ROOT/$PIDFILE --background --no-close --make-pidfile --chuid $USER --user $USER --chdir $BINARYPATH --exec -- -D -m -S $SCREENREF $RUNTIME $BINARYPATH/$BINARYNAME $OPTS 41 sleep 1 42 fi 43 else 44 echo "Could not find binary, aborting!" 45 exit 5 46 fi 47 if [ `pgrep -F $SDTD_ROOT/$PIDFILE` ]; then 48 echo "Done!" 49 else 50 echo "Failed!" 51 rm -f $SDTD_ROOT/$PIDFILE 52 fi 20 echo "Starting all 7dtd instances:" 21 for I in $SDTD_BASE/instances/*; do 22 ins=`basename $I` 23 echo "Starting: $ins" 24 /usr/local/bin/7dtd-start.sh $ins 25 done 26 echo "All done" 53 27 ;; 54 28 stop) 55 start-stop-daemon --status --pidfile $SDTD_ROOT/$PIDFILE 56 if [ $? -eq 0 ]; then 57 echo -n "Stopping the $NAME server... " 58 if [ "$SDTD_TELNET_ENABLED" = "true" ] && [ -n "$SDTD_TELNET_PASSWORD" ]; then 59 echo "$SDTD_TELNET_PASSWORD\nshutdown" | nc -q 2 127.0.0.1 $SDTD_TELNET_PORT 60 sleep 5 61 else 62 echo "Telnet not enabled or no password set. No graceful shutdown!" 63 fi 64 start-stop-daemon --stop --pidfile $SDTD_ROOT/$PIDFILE 65 rm $SDTD_ROOT/$PIDFILE 66 echo "Done!" 67 else 68 echo "$NAME not running" 69 fi 29 echo "Stopping all 7dtd instances:" 30 for I in $SDTD_BASE/instances/*; do 31 ins=`basename $I` 32 echo "Stopping: $ins" 33 /usr/local/bin/7dtd-kill.sh $ins 34 echo 35 echo 36 done 37 echo "All done" 70 38 ;; 71 39 status) 72 start-stop-daemon --status --pidfile $SDTD_ROOT/$PIDFILE 73 if [ $? -eq 0 ]; then 74 echo "$NAME server is running" 75 else 76 echo "$NAME server not running" 77 fi 40 /usr/local/bin/7dtd-instances.sh 78 41 ;; 79 42 *)
Note:
See TracChangeset
for help on using the changeset viewer.