Jump to content

Help with dedicated server


Afro

Recommended Posts

Hey zombie killers I need some help.
 Some background: I'm VERY new to Linux, hosting servers, the game itself etc but I played it recently and LOVED it.
I finally managed to set up a dedicated server for me and my friends. It's running on Debian 11.

 Now my query, I am wondering if there is anyway to put the pc to sleep when none of us are on and then be able to wake remotely from my android phone and run the server start script when me or my friends wanna play but I'm not home so I don't have to run it 24/7.

I'm assuming doing this will help with the electricity bill haha.

Any help is appreciated!

Link to comment
Share on other sites

There are multiple ways:

 

You can make the game server start at boot time with systemd. Alternatively with crontab you can start and stop the server at specific times.

Stopping just when your friends are finished is a little more complicated if you don't want your friends have an account on that server or easy if that is no problem. Alternatively stopping can be done with crontab again at specific times when you are sure nobody is playing (for example on my server I let the stop-script run every night at 3 am)

 

Turning on a machine from phone is possible as well, I just don't know if there is an android app that does it. And you would have to find out if you can do it from anywhere with the help of your router and some port-forwarding. Search for "wake-on-lan". If wake-on-lan isn't working that way and you can't find another way to wake up the machine you might have to let the machine run and only have the server running on request. Or turn on the machine regularily at specific times, like every night at 9.

 

So I would start by finding out if the wake-on-lan thingy works.

 

Edited by meganoth (see edit history)
Link to comment
Share on other sites

Hey @meganoth, thanks for your reply!

I've managed to set up wake on Lan and now I've been trying to set up running the server start command (./sdtdserver start) on wake (not boot) and server stop (./sdtdserver stop) on sleep with systemd. I think I'm doing something wrong.

I made a text file in systemd/system-sleep called: pre-suspend.sh.

 

In the file I put these lines: 

#!/bin/bash

if [ "${1}" == "pre" ]; then

./sdtdserver stop

elif [ "${1}" == "post" ]; then

./sdtdserver start

fi

 

I'm pretty sure I've done this wrong, any help would be great, thanks.

Link to comment
Share on other sites

Ok, where is this sdtdserver-script located that you are calling there? You probably have to change into the right directory or use an absolute path for this script. Possibly you need to add exec rights to the script, so do "chmod a+x pre-suspend.sh" to be sure.

 

I don't know anything about how systemd handles sleep and would have to consult man pages and documentation and tutorials on the internet as well for that case. Currently you know more about it than I do 😉.

 

Please also try to give more detailed information about the problems than "I've done this wrong" 😉

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...