Absurd Minds

More than 100 years without a motto.
It is currently 28 Mar 2024 09:58

All times are UTC-04:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 23 Mar 2012 22:21 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8392
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:
Code:
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.sh
The 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
Code:
#!/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 0
This 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).
Code:
#!/bin/bash

screen -X -S aim quit
sleep 10
cd /home/gamer/cstrike/aim
/usr/bin/screen -dmS aim ./hlds_run -game cstrike +ip 70.34.195.6 +port 27015 +map aim_map -autoupdate +maxplayers 21 -pingboost 1

_________________
Server list
Donate


Top
   
PostPosted: 01 Feb 2013 14:41 
Offline

Joined: 26 Mar 2010 00:47
Posts: 41
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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC-04:00


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited