Techie
Fixed an auto-create issue with Xen Domains (DomU’s)
by Logan Rogers-Follis on Jun.06, 2009, under Techie
To get my Xen domains to auto-create with via service I have created my own /etc/init.d/xendomains Run-level Startup script. It will still not auto-create on boot up (after a halt/reboot) but at least I can start the files in /etc/xen/auto/ via “service xendomains start” now. This issue of not auto-creating the Xen domains is not an issue with this script, but rather my server I still need to debug. I did “mv /etc/init.d/xendomains /etc/init.d/xendomains.old.script” to backup the old script for later use, then I created a new /etc/init.d/xendomains file with the following script in it:
Custom xendomains Run-level Startup script:
#!/bin/bash
#
# Run-level Startup script for starting Xen domains
#
# chkconfig: 345 99 00
# Description: Starts and stops Xen domains# Created to fix Xen auto-start issue on my CentOS 5.3 / Xen 3.0.3 Server
# Created by Logan Rogers-Follis on 06-06-2009# Depending on parameter — startup, shutdown, restart, reload
# of the instance and listener or usage displayxen_auto=”/etc/xen/auto/”
lock_file=”/var/lock/subsys/xendomains”
sleep_time=40# If the folder does not exist or is empty — display error
if [ ! -d $xen_auto ]
then
echo “Missing $xen_auto folder: cannot start”
exit 1
elif [ ! “$(ls -A $xen_auto)” ]
then
echo “No files in $xen_auto: cannot start”
exit 1
ficase “$1” in
start)
# Check for lock_file & Create Xen domains
if [ -f $lock_file ]
then
echo “Xen domains are already running!”
else
echo “Create Xen domains:”
for u in $(ls $xen_auto*)
do
xm create $u
done
touch $lock_file
echo “Xen domains created!”
fi
;;
stop)
# Check for lock_file & Shutdown Xen domains
if [ ! -f $lock_file ]
then
echo “Xen domains are not running!”
else
echo -n “Shutdown Xen domains: ”
cd $xen_auto
for z in $(ls *)
do
xm shutdown $z
done
rm -f $lock_file
echo “OK”
fi
;;
reload|restart)
$0 stop
echo “Sleeping for $sleep_time second while the Xen domains finish their shutdown!”
sleep $sleep_time
$0 start
;;
*)
echo “Usage: $0 start|stop|restart|reload”
exit 1
esac
exit 0
Linux Service scripts for TF2 and L4D
by Logan Rogers-Follis on Jun.06, 2009, under Techie
While I was working on the Unreal Tournament 3 (UT3) server I found a great post on the Epic Games Forum by Kzoink that had a Liunux Service script for UT3. I have adjusted it to correctly terminate both the srcds_run an srcds_i486. Below are copies of the them I am now using on my TF2 and L4D servers. I am using his original script for my upcoming UT3 server.
NOTE: For these scripts to work correctly you’ll need to ensure you have a file called startserver.sh in the tf2/l4d_home path that has “chmod +x” permissions. The startserver.sh file will contain your startup command line for the game. Please see one of the game server configs or Linux Service scripts at my Articles section for examples of the startserver.sh files you can use.
Team Fortress 2 (TF2) Linux Service script (please change tf2_home & tf2_ownr accordingly):
#!/bin/bash
#
# Run-level Startup script for srcds_run
#
# chkconfig: 345 91 19
# description: Starts and stops hlds dedicated server binarytf2_home=”/home/teamfortress2/hlds/orangebox/”
tf2_ownr=”teamfortress2″# if the executables do not exist — display error
if [ ! -f $tf2_home/startserver.sh -o ! -d $tf2_home ]
then
echo “HLDS TF2 Server: cannot start”
exit 1
fi# depending on parameter — startup, shutdown, restart
# of the instance and listener or usage displaycase “$1” in
start)
# HLDS TF2 basic start script or command can be called here. For my purposes I placed the entire command line a shell script called startserver.sh
echo -n “Starting HLDS TF2 Server: ”
su – $tf2_ownr -c “cd $tf2_home && ./startserver.sh &”
touch /var/lock/subsys/teamfortress
echo “OK”
;;
stop)
# TF2 kill-shutdown
echo -n “Shutdown HLDS TF2 Server: ”
su – $tf2_ownr -c “killall srcds_run”
su – $tf2_ownr -c “killall srcds_i486”
rm -f /var/lock/subsys/teamfortress
echo “OK”
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo “Usage: $0 start|stop|restart|reload”
exit 1
esac
exit 0
Left 4 Dead (L4D) Linux Service script (please change l4d_home & l4d_ownr accordingly):
#!/bin/bash
#
# Run-level Startup script for srcds_run
#
# chkconfig: 345 91 19
# description: Starts and stops hlds dedicated server binaryl4d_home=”/home/left4dead/hlds/l4d/”
l4d_ownr=”left4dead”# if the executables do not exist — display error
if [ ! -f $l4d_home/startserver.sh -o ! -d $l4d_home ]
then
echo “HLDS L4D Server: cannot start”
exit 1
fi# depending on parameter — startup, shutdown, restart
# of the instance and listener or usage displaycase “$1” in
start)
# HLDS L4D basic start script or command can be called here. For my purposes I placed the entire command line a shell script called startserver.sh
echo -n “Starting HLDS L4D Server: ”
su – $l4d_ownr -c “cd $l4d_home && ./startserver.sh &”
touch /var/lock/subsys/left4dead
echo “OK”
;;
stop)
# L4D kill-shutdown
echo -n “Shutdown HLDS L4D Server: ”
su – $l4d_ownr -c “killall srcds_run”
su – $l4d_ownr -c “killall srcds_i486”
rm -f /var/lock/subsys/left4dead
echo “OK”
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo “Usage: $0 start|stop|restart|reload”
exit 1
esac
exit 0
UPDATE: TF2 Arena server.cfg
by Logan Rogers-Follis on Jun.06, 2009, under Techie
I found that there were some random lag issues in the server.cfg I had posted, so I have edited my post and the copy in the Articles section. Please update you cfg if you are using a copy of mine!
TF2 Arena server.cfg
by Logan Rogers-Follis on May.31, 2009, under Techie
Here is the server.cfg I am using for my Arena ONLY TF2 server. I have deleted the config_arena.cfg file from the /cfg directory and I also renamed the arena_mapcycle.txt to mapcycle.txt. I also edited the maplist.txt file accordingly (includes only arena_ maps). Sorry I have not commented what all the cvars do.
maxplayers 18
hostname “[HOSTNAME]”
mapcyclefile “mapcycle.txt”rcon_password “[RCON_PASSWORD]”
sv_rcon_banpenalty 5
sv_rcon_maxfailures 10exec banned_user.cfg
exec banned_ip.cfg
writeid
writeip
host_thread_mode 1sv_lan 0
sv_region 255
sv_contact [URL_OR_EMAIL]
sv_pausable 0
sv_pure 1
sv_pure_kick_clients 1sv_voiceenable 1
sv_alltalk 1
mp_chattime 15mp_disable_autokick 1
sv_allowupload 0
sv_allowdownload 0sv_minrate 2000
sv_maxrate 25000
decalfrequency 10
sv_maxupdaterate 120
sv_minupdaterate 20
sv_mincmdrate 66
sv_maxcmdrate 100
sv_client_cmdrate_difference 1
sv_client_predict 1
sv_client_interpolate 1
sv_client_min_interp_ratio -1
sv_client_max_interp_ratio -1log on
sv_logbans 1
sv_logecho 1
sv_logfile 1
sv_log_onefile 1mp_maxrounds 20
mp_winlimit 15
mp_timelimit 30mp_forcecamera 1
mp_allowspectators 1
mp_footsteps 1
sv_cheats 0
sv_timeout 150
sv_consistency 1
decalfrequency 10mp_autoteambalance 1
mp_autoteambalance_delay 60
mp_autoteambalance_warning_delay 30
mp_teams_unbalance_limit 1mp_enableroundwaittime 0
mp_bonusroundtime 15
mp_restartround 0
mp_stalemate_timelimit 0
mp_stalemate_enable 0
L4D Server.cfg
by Logan Rogers-Follis on May.26, 2009, under Techie
I have 3 rock solid L4D servers now running. Below are the server.cfg I am running.
server.cfg from my I Hate EVERYTHING (loads CO-OP Campaign by default, but supports all 3 modes):
hostname “[CHANGEME]” // this is your server name as shown in the server list
// start rcon settings
rcon_password “[CHANGEME]” // your rcon password to log into the dev rcon console or HLSW rcon console
// end rcon settings// L4D cvars
//sv_password “” // your server password. a pair of double quotes means it is not set and anyone can join
motd_enabled 1 //This enables or disables the message of the day.
z_difficulty hard //Server difficulty set to expert, settings can be changed in lobby
sv_steamgroup [CHANGEME] //will make your server show up on steam group servers list
sv_steamgroup_exclusive 0 //Only your steam group will have access to the server if enabled.
sv_allow_lobby_connect_only 0 //People will only be able to connect from lobby, change to 0 to allow people to join a game in progress
sv_gametypes “coop,versus,survival” //It’s set up to allow both campaign and verses. You can decide which type of game to play in the lobby.
mp_gamemode “coop” //default game type loaded on server boot
//sv_search_key “” //This will allow you to connect to your server from the lobby.
// end L4D cvars// start client specific cvars
sv_cheats 0 // allow cheats to be used by the client. 0 is off 1 is on
sv_consistency 1 // Force clients to pass a consistency check for critical files before joining server. 0 is off 1 is on
// end client specific cvars// start cvars for communication
sv_voiceenable 1 // allow players to use a microphone. 0 is off 1 is on
sv_alltalk 0 // toggles whether both teams can hear each others voice comms or not. 0 is off 1 is on. recommend it being off
// end cvars for communication// bandwidth rates/settings
sv_maxcmdrate 100
cl_cmdrate 30
cl_updaterate 20
rate 20000
sv_minrate 5000
sv_maxrate 8000
// end bandwidth rates/settings// start server logging
log on // enable or disable server logging. on is on off is off
sv_logbans 1 // Log server bans in the server logs
sv_logecho 1 // Echo log information to the console. 0 is off 1 is on
sv_logfile 1 // Log server information in the log file. 0 is off 1 is on
sv_log_onefile 0 // log everything in one file
// end server logging// start cvars for general operation
hostport 27015 //default 27015. Change if you are running multiple servers on the same IP
sv_lan 0 // is this an internet or LAN server. 0 is internet 1 is LAN
sv_region 1 // server location 0 is USA east coast, 1 is USA west coast, 255 is World
sv_contact “[CHANGEME]” // contact email for sysop. e-mail or url
sv_pausable 0 // enables or disables whether the server can be paused. 0 is off 1 is on
sv_pure 1 // forces all clients on the server to use content that matches what is on the server. 0 is off 1 is on
sv_pure_kick_clients 1 // kicks clients that do not have content that matches what is on the server
// end cvars for general operation// execute
exec banned_user.cfg
exec banned_ip.cfg
writeid
writeip
// end of execute// other shit
mp_disable_autokick 1
setmaster enable
setmaster add 68.142.72.250:27011
setmaster add 72.165.61.189:27011
server.cfg from my I Hate VS (loads VS and supports only VS):
hostname “[CHANGEME]” // this is your server name as shown in the server list
// start rcon settings
rcon_password “[CHANGEME]” // your rcon password to log into the dev rcon console or HLSW rcon console
// end rcon settings// L4D cvars
//sv_password “” // your server password. a pair of double quotes means it is not set and anyone can join
motd_enabled 1 //This enables or disables the message of the day.
sv_steamgroup [CHANGEME] //will make your server show up on steam group servers list
sv_steamgroup_exclusive 0 //Only your steam group will have access to the server if enabled.
sv_allow_lobby_connect_only 0 //People will only be able to connect from lobby, change to 0 to allow people to join a game in progress
sv_gametypes “versus” //It’s set up to allow verses only. You can decide which type of game to play in the lobby.
mp_gamemode “versus” //Default game type used.
//sv_search_key “” //This will allow you to connect to your server from the lobby.
sv_visiblemaxplayers 8
// end L4D cvars// start client specific cvars
sv_cheats 0 // allow cheats to be used by the client. 0 is off 1 is on
sv_consistency 1 // Force clients to pass a consistency check for critical files before joining server. 0 is off 1 is on
// end client specific cvars// start cvars for communication
sv_voiceenable 1 // allow players to use a microphone. 0 is off 1 is on
sv_alltalk 0 // toggles whether both teams can hear each others voice comms or not. 0 is off 1 is on. recommend it being off
// end cvars for communication// bandwidth rates/settings
sv_maxcmdrate 100
cl_cmdrate 30
cl_updaterate 20
rate 20000
sv_minrate 5000
sv_maxrate 8000
// end bandwidth rates/settings// start server logging
log on // enable or disable server logging. on is on off is off
sv_logbans 1 // Log server bans in the server logs
sv_logecho 1 // Echo log information to the console. 0 is off 1 is on
sv_logfile 1 // Log server information in the log file. 0 is off 1 is on
sv_log_onefile 0 // log everything in one file
// end server logging// start cvars for general operation
hostport 27015 //default 27015. Change if you are running multiple servers on the same IP
sv_lan 0 // is this an internet or LAN server. 0 is internet 1 is LAN
sv_region 255 // server location 0 is USA east coast, 1 is USA west coast, 255 is World
sv_contact “[CHANGEME]” // contact email for sysop. e-mail or url
sv_pausable 0 // enables or disables whether the server can be paused. 0 is off 1 is on
sv_pure 1 // forces all clients on the server to use content that matches what is on the server. 0 is off 1 is on
sv_pure_kick_clients 1 // kicks clients that do not have content that matches what is on the server
// end cvars for general operation// execute
exec banned_user.cfg
exec banned_ip.cfg
writeid
writeip
// end of execute// other shit
mp_disable_autokick 1
setmaster enable
setmaster add 68.142.72.250:27011
setmaster add 72.165.61.189:27011
server.cfg from my I Hate COOP (loads Survival and supports Campaign / Survival):
hostname “[CHANGEME]” // this is your server name as shown in the server list
// start rcon settings
rcon_password “[CHANGEME]” // your rcon password to log into the dev rcon console or HLSW rcon console
// end rcon settings// L4D cvars
//sv_password “” // your server password. a pair of double quotes means it is not set and anyone can join
motd_enabled 1 //This enables or disables the message of the day.
z_difficulty hard //Server difficulty set to expert, settings can be changed in lobby
sv_steamgroup [CHANGEME] //will make your server show up on steam group servers list
sv_steamgroup_exclusive 0 //Only your steam group will have access to the server if enabled.
sv_allow_lobby_connect_only 0 //People will only be able to connect from lobby, change to 0 to allow people to join a game in progress
sv_gametypes “coop,survival” //It’s set up to allow both campaign and verses. You can decide which type of game to play in the lobby.
mp_gamemode “survival” //Default game type.
//sv_search_key “” //This will allow you to connect to your server from the lobby.
sv_visiblemaxplayers 4
// end L4D cvars// start client specific cvars
sv_cheats 0 // allow cheats to be used by the client. 0 is off 1 is on
sv_consistency 1 // Force clients to pass a consistency check for critical files before joining server. 0 is off 1 is on
// end client specific cvars// start cvars for communication
sv_voiceenable 1 // allow players to use a microphone. 0 is off 1 is on
sv_alltalk 0 // toggles whether both teams can hear each others voice comms or not. 0 is off 1 is on. recommend it being off
// end cvars for communication// bandwidth rates/settings
sv_maxcmdrate 100
cl_cmdrate 30
cl_updaterate 20
rate 20000
sv_minrate 5000
sv_maxrate 8000
// end bandwidth rates/settings// start server logging
log on // enable or disable server logging. on is on off is off
sv_logbans 1 // Log server bans in the server logs
sv_logecho 1 // Echo log information to the console. 0 is off 1 is on
sv_logfile 1 // Log server information in the log file. 0 is off 1 is on
sv_log_onefile 0 // log everything in one file
// end server logging// start cvars for general operation
hostport 27015 //default 27015. Change if you are running multiple servers on the same IP
sv_lan 0 // is this an internet or LAN server. 0 is internet 1 is LAN
sv_region 255 // server location 0 is USA east coast, 1 is USA west coast, 255 is World
sv_contact “[CHANGEME]” // contact email for sysop. e-mail or url
sv_pausable 0 // enables or disables whether the server can be paused. 0 is off 1 is on
sv_pure 1 // forces all clients on the server to use content that matches what is on the server. 0 is off 1 is on
sv_pure_kick_clients 1 // kicks clients that do not have content that matches what is on the server
// end cvars for general operation// execute
exec banned_user.cfg
exec banned_ip.cfg
writeid
writeip
// end of execute// other shit
mp_disable_autokick 1
setmaster enable
setmaster add 68.142.72.250:27011
setmaster add 72.165.61.189:27011
Questions please contact me or leave a comment. I’ll get a forum going if it’s actually ever needed!