1,575
edits
Changes
→Finalize the Setup
##Install ''[http://software.clapper.org/daemonize/ daemonize]'' (for use in our init.d script) by running <pre>sudo apt install daemonize</pre>
##Create a new service file by running <pre>sudo nano /etc/init.d/quakejs</pre>
##Fill the file with the following THIS DOESN'T WORK YET<pre>#!/bin/sh # BEGIN INIT INFO # Provides: /etc/init.d/quakejs # Subsystem file for "quakejs" server # Required-Start: $network # Required-Stopchkconfig: $network2345 95 05 # Default-Startdescription: 2 3 4 5QuakeJS server daemon # Default-Stop: 0 1 6 # Short-Descriptionprocessname: QuakeJs Serverquakejs # Descriptionpidfile: Starts/Stopsvar/Restarts the QuakeJS Server Daemonrun/quakejs.pid RETVAL=0&## END INIT INFO10;prog="quakejs" set -estart() { echo "Starting $prog:" PATH=daemonize -v -p /var/run/$prog.pid -c /usrhome/localquake/sbin:quakejs -u quake /usr/local/bin:/sbin:node build/bin:ioq3ded.js +set fs_game baseq3 set dedicated 1 +exec server.cfg RETVAL=$? [ "$RETVAL" = 0 ] && touch /usrvar/sbin:lock/usrsubsys/bin$prog echo } stop() { DESC=echo "QuakeJS ServerStopping $prog:" NAME=quakejskillproc $prog -serverTERM USERRETVAL=quake$? DIR[ "$RETVAL" =0 ] && rm -f /var/homelock/quakesubsys/quakejs$prog echo } DAEMON=node build/ioq3ded.js +set fs_game baseq3 set dedicated case "$1 +exec server.cfg" in start) start ;; stop) stop ;; restart) stop sleep 3 start ;; condrestart)&#PIDFILE=10; if [ -f /var/runlock/subsys/$NAME.pidprog ] ; then stop # avoid race sleep 3 start fi ;; status) status $prog SCRIPTNAME RETVAL=/etc/init.d/$NAME? ;; # Gracefully exit if the package has been removed.*) test -x echo $"Usage: $DAEMON 0 {start|stop|restart| exit 0condrestart|status}" RETVAL=1 sleep 2esac sudo -u $USER $DAEMON $1 exit $OPTIONSRETVAL </pre>
##Make our new file executable by running <pre>sudo chmod +x /etc/init.d/quakejs</pre>
##Enable it by running <pre>sudo update-rc.d quakejs defaults</pre>