scheduled restarts

Ask questions about dedicated servers here and we and other users will do our best to answer them. Please also refer to the self-help section for tutorials and answers to the most commonly asked questions.
Post Reply
crs4380
A semi-regular
A semi-regular
Posts: 20
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Thu Jan 01, 2009 3:10 am

scheduled restarts

Post by crs4380 »

How would I go about creating daily scheduled restarts for game server (s)? I'm using centos 5.4 and read something about init.d scripts. Not sure if that's the way to do and it's confusing

So, what's the best method to do this?
crs4380
A semi-regular
A semi-regular
Posts: 20
Joined: Thu Jan 01, 2009 3:10 am

Re: scheduled restarts

Post by crs4380 »

I mean, what's the best way to create scheduled restarts for game servers? I'll be running quake 3 servers.
User avatar
Edge100x
Founder
Founder
Posts: 12945
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: scheduled restarts

Post by Edge100x »

One way that you could do this is with a crontab entry that kills everything matching the name of your process. For instance, if your q3 process is named "q3ded", then you could edit your crontab through "crontab -e" and add something like this to restart everything at 5am:

0 5 * * * killall q3ded
crs4380
A semi-regular
A semi-regular
Posts: 20
Joined: Thu Jan 01, 2009 3:10 am

Re: scheduled restarts

Post by crs4380 »

Thanks for the reply. I figured out a way to do scheduled restarts but I dislike that crontabs don't allow for running processes in seconds. After looking around online I've come to a conclusion that I'll need to learn how to do init scripts because I don't really like waiting 1 minute for my servers to be restarted and prefer it to be done in a few seconds.

So, where would I learn about init scripts? I've been searching around online and there are a lot of guides to help me but most of them aren't good.

John, if you don't mind me asking. I would like to know how NFO does scheduled restarts for game servers.
User avatar
Edge100x
Founder
Founder
Posts: 12945
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: scheduled restarts

Post by Edge100x »

crs4380 wrote:Thanks for the reply. I figured out a way to do scheduled restarts but I dislike that crontabs don't allow for running processes in seconds. After looking around online I've come to a conclusion that I'll need to learn how to do init scripts because I don't really like waiting 1 minute for my servers to be restarted and prefer it to be done in a few seconds.
You can easily compensate for not having second granularity. Just put a "sleep" statement in before the statement you want to execute to have it happen at whatever part of the minute you want. Want it to happen 5 seconds before the next minute? Just use something like this:

Code: Select all

0 5 * * * sleep 55 && killall q3ded
Or, combine killing with stopping in a single script.
So, where would I learn about init scripts? I've been searching around online and there are a lot of guides to help me but most of them aren't good.
I'd recommend looking at the init scripts provided by the OS as examples. I have not looked into it before, so I can't think of a good reference for them.
John, if you don't mind me asking. I would like to know how NFO does scheduled restarts for game servers.
We script it. Stop, wait, start again.
crs4380
A semi-regular
A semi-regular
Posts: 20
Joined: Thu Jan 01, 2009 3:10 am

Re: scheduled restarts

Post by crs4380 »

Ah, I see. Thanks.
Post Reply