15
10
I am hosting some Counter-Strike game servers on my dedicated server using screen. I have this script that I run when I want to start/stop the servers:
#! /bin/sh
# /etc/init.d/css-server
#
case "$1" in
start)
echo "Starting Nullus Imprimis war server..."
screen -A -m -d -S css-war-server /home/css-servers/war-server/css/srcds_run -game cstrike +map de_dust2 +maxplayers 16 -autoupdate -port 2555 -tick 100
echo "Nullus Imprimis war server started"
echo "Starting Nullus Imprimis pub server #1..."
screen -A -m -d -S css-pub-server-1 /home/css-servers/pub-server-1/css/srcds_run -game cstrike +map de_dust2 +maxplayers 32 -autoupdate -port 2666 -tickrate 100
echo "Nullus Imprimis pub server #1 started"
;;
stop)
echo "Stopping Nullus Imprimis war server..."
screen -S css-war-server -X quit
echo "Nullus Imprimis war server stopped"
echo "Stopping Nullus Imprimis pub server #1..."
screen -S css-pub-server-1 -X quit
echo "Nullus Imprimis pub server #1 stopped"
;;
*)
echo "Usage: /etc/init.d/css-servers {start|stop}"
exit 1
;;
esac
exit 0
I put this script (called css-servers
) in /etc/init.d/
and to my knowledge that means it gets run when the system boots up. However when I check active screens using screen -ls
there are none running.
How can I make these run on startup under Ubuntu Server?
This is extremely strange. Up until this point my script run at startup without this
update-rc.d
command. I updated my script then it didn't run anymore until i run this command. Thanks. By the way, how can we "deregister" it from running at startup (as we did with update-rc.d)? – Nikos – 2018-01-16T09:50:52.7901@Nik-Lz This Q&A refers to old and obsolete versions of Ubuntu which used upstart. It should no longer be used, instead the current systemd (which uses a completely different service system) should be used. – Michael Hampton – 2018-01-16T16:11:41.553