|rebooting servers and rebooting machine script
|Page 1 of 1|
|Author:||Amaroq [ 23 Mar 2012 22:21 ]|
|Post subject:||rebooting servers and rebooting machine script|
So I created a few scripts to help manage automatic rebooting of servers and machines. This is what I did:
as root, I editted /etc/crontab to include three lines:
00 6 * * 0,2,3,4,5,6 gamer /home/gamer/start.sh 00 6 * * 1 root /usr/bin/reboot @reboot gamer /home/gamer/start.shThe first line says that at 6:00 on Sundays, Tuesdays, Wednesdays, Thursdays, Fridays, and Saturdays, it should execute a script I made called start.sh (this will be posted further along).
The second line says that at 6:00 every Monday morning, the server needs to reboot.
The third line says that when it reboots, the server needs to execute that start.sh script.
In my home directory, I put start.sh
#!/bin/bash /home/gamer/cstrike/aim/aim.sh sleep 120 /home/gamer/cstrike/chill/chill.sh sleep 120 /home/gamer/cstrike/custom/custom.sh sleep 120 /home/gamer/cstrike/practice/practice.sh sleep 120 /home/gamer/cstrike/private/private.sh sleep 120 /home/gamer/cstrike/pub/pub.sh sleep 120 /home/gamer/cstrike/pug/pug.sh sleep 120 /home/gamer/czero/bones/bones.sh sleep 120 /home/gamer/czero/survivor/survivor.sh sleep 120 /home/gamer/tf2/cp/orangebox/cp.sh sleep 120 /home/gamer/tf2/pl/orangebox/pl.sh sleep 120 /home/gamer/tf2/vanilla/orangebox/vanilla.sh sleep 120 /home/gamer/gmod/orangebox/gmod.sh exit 0This script says that I need to execute a number of scripts (one for each server), with 2 minutes of wait time in between each execution. Each line points to the script for each server.
Here is an example of a startup script for one individual server (eg, aim.sh). Make sure to place this script in the directory from which you launch your server (or make sure your script directs you there).
#!/bin/bash screen -X -S aim quit sleep 10 cd /home/gamer/cstrike/aim /usr/bin/screen -dmS aim ./hlds_run -game cstrike +ip 220.127.116.11 +port 27015 +map aim_map -autoupdate +maxplayers 21 -pingboost 1
|Author:||SavSin [ 01 Feb 2013 14:41 ]|
|Post subject:||Re: rebooting servers and rebooting machine script|
The servers that run amx I can give you a script that "crashes" the server when no one is on it at a specified time to reboot it. If there are players it waits until the current map is over and warms the players
|Page 1 of 1||All times are UTC-04:00|
|Powered by phpBB® Forum Software © phpBB Limited