1,575
edits
Changes
→Finalize the Setup
=Finalize the Setup=
#Configure Debian to autorun our server on boot
##Run Create a new service file by running <pre>sudo nano /etc/init.d/quakejs</pre>
##Fill the file with the following <pre>### BEGIN INIT INFO # Provides: quakejs # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: QuakeJs Server # Description: Starts/Stops/Restarts the QuakeJS Server Daemon ### END INIT INFO set -e PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="QuakeJS Server" NAME=quakejs-server USER=quake DIR=/home/quake/quakejs DAEMON=node build/ioq3ded.js +set fs_game baseq3 set dedicated 1 +exec server.cfg #PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 sleep 2 sudo -u $USER $DAEMON $1 $OPTIONS </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>
##You can test this by running <pre>sudo systemctl start quakejs</pre> and/or rebooting your machine by running <pre>sudo reboot</pre>
#Lastly we need to remove ''sudo'' privileges from user ''quake''
##Get back to our original sudo user (not ''quake'') by running the following command which undoes ''su - quake'' <pre>exit</pre>
##Remove ''quake'' from the ''sudo'' group by running <pre>gpasswd -d quake sudo</pre>
That's it! Whenever your ''quakejs'' server boots up it will automatically start the ''quakejs'' game server and Apache2 webserver. When a computer on your LAN visits http://quakejs/ they'll automatically download the files they need from http://quakejs/assets/ and then connect to the QuakeJS server at quakejs:27960.
Get a few friends together, have them point their browsers to http://quakejs/ and start fragging!