Quantcast
Channel: linuxadmin: Expanding Linux SysAdmin knowledge
Viewing all articles
Browse latest Browse all 17915

How do I solve having my server automatically shutdown, if a UDP port has not been active for a certain amount of time?

$
0
0

I suppose this may be an odd question, but I have a small EC2-instance that costs quite a large sum of money every month. It's charged hourly though, so I only turn on this particular instance when I need it, and power it off when I'm done.

The purpose of this instance is for hosting a Counter-Strike: Global Offensive dedicated server which I only power-on when I have a scrim to play a few times a month.

Instead of forgetting to turn it off and being charged a lot, or having an unintelligent start-up script that asks the instance to power-off after 3 hours, I was thinking of a more intelligent design.

Here's my idea; that the instance intelligently powers itself off when it senses it is no longer in use, by determining if a certain amount of network activity on UDP 27015 has not been recorded over the last 10 minutes, trying 3 times before powering off.

That way I can power-on, play the match, and not worry about powering off the server :-)

It sounds cool in my head. The question is how I go about solving the task. I imagine a bash-script executed every 10 minutes with the help of cron.

If I'm not being entirely crazy here, could a bash-script suggestion possibly be offered? Or maybe a better solution how I solve this quest I'm on, to save $$ by having the server power itself off when sensing it is no longer in use!

submitted by Wordpad
[link][16 comments]

Viewing all articles
Browse latest Browse all 17915

Latest Images

Trending Articles



Latest Images