Score:0

How to setup a cron tab to restart a game server using screen

xk flag

I'm using Ubuntu 18.04. I have been trying to setup a scheduled restart every 2 days at 4 AM for my Unturned Server.

This is my crontab:

* */3 * * * root/.steam/steamcmd/Unturned1 ; screen -XS Unturned1 quit; /usr/bin/screen -dmS Unturned1 ; ./ServerHelper.sh +InternetServer/Unturned1

The "*/3" is just to test every 3 minutes, the crontab successfully ends the screen and starts a new one, but when it's supposed to execute the shell to start the server it just glitches and stays like this:

screen when it's supposed to start the shell

cn flag
Don't. Create a service unit (and a timer if you want). Takes about 10m to create and you can then stop/start/restart the unit and you can add that to cron. Far more versatile.
cn flag
you did not install steam in root/ did you? :P Very bad if you did ;) use /opt/ or /home/$USER/
Pa Zo avatar
xk flag
i tried installing it using linuxgsm through an user but when i uploaded some files to the server i ran into some permission issues that i wasnt able to fix, so i decided to just install it on root instead of a user, anyways, i have taken a look at systemd and i would want to know how do i add a .service file to the crontab? also, is there any way to execute a command in the server console to warn players before server is restarted?
Rohit Gupta avatar
pg flag
Is there a reason for posting a blank screen.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.