Skip to content

Instantly share code, notes, and snippets.

@kcollasarundell
Last active January 1, 2016 03:59
Show Gist options
  • Save kcollasarundell/8089388 to your computer and use it in GitHub Desktop.
Save kcollasarundell/8089388 to your computer and use it in GitHub Desktop.
quick rewrite of a kiling floor init script to upstart
description "Starting a quick and dirty killingfloor server with upstart"
#put this file into /etc/init/
#Start the service when the host has network and filesystems
start on (local-filesystems and net-device-up and runlevel [2345])
stop on runlevel [016]
#the magic restart
respawn
respawn limit 15 5
env USER=YOUREALLYSHOULDN'TRUNTHISASROOTBUTTHATWILLINVOLVEMORECHANGES
env SCREEN_NAME=killing-floor
env GAME_PATH=//srcds_l/killingfloor/system
export GAME_PATH
chdir /root/killingfloor/System
script
/usr/bin/screen -A -m -d -S $SCREEN_NAME ./ucc-bin server KF-BioticsLab.rom?game=KFmod.KFGameType?VACSecured=true?MaxPlayers=20?Mutator=ServerPerksMut.ServerPerksMut,ScrnBalanceSrv.ScrnBalance,MutKFAntiBlocker.MutKFAntiBlocker,KFPatHPLeft.MutPatHPLeft,RgMsgMut.RgMsgMut
end script
#!/bin/bash
#
# Init file for Killing Floor server
#
# chkconfig: 35 90 12
# description: Killing Floor
#
# source function library
. /lib/lsb/init-functions
SCREEN_NAME=killing-floor
GAME_PATH=//srcds_l/killingfloor/system
start()
{
cd /root/killingfloor/System && /usr/bin/screen -A -m -d -S $SCREEN_NAME ./ucc-bin server KF-BioticsLab.rom?game=KFmod.KFGameType?VACSecured=true?MaxPlayers=20?Mutator=ServerPerksMut.ServerPerksMut,ScrnBalanceSrv.ScrnBalance,MutKFAntiBlocker.MutKFAntiBlocker,KFPatHPLeft.MutPatHPLeft,RgMsgMut.RgMsgMut
}
stop()
{
PID=`ps fax | grep $SCREEN_NAME | grep SCREEN | awk '{ print $1 }'`
kill $PID
}
restart()
{
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment