Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
If you can, then you can just use cron to periodically send the commands to the server console.
Basically, I created a scheduled task to start the server whenever the machine boots up. Similarly, I did the same for device shutdown. Yesterday, after the restart, our cars vanished, but when we left the chunk, they reappeared. So maybe the quit and save commands aren't that necessary after all?
Currently, the system startup is handled by a .service file in /etc/systemd/system/, which basically just starts the .sh file in the game folder. I assume if I delete this task and instead run it with tmux, I'll be able to access the console and run the commands, correct? But how do I schedule tmux to start automatically once the machine boots up? Do I make a different .service file in /etc/systemd/system/ for tmux startup? That's the part I don't really understand.
https://www.geeksforgeeks.org/how-to-set-tmux-for-opening-specified-windows-at-startup/
You would basically just script starting tmux, then send-keys to Tmux to launch the startserver.sh file, and you should be done at that point..
Then you can create a cron job to tmux send-keys for any commands you want into the session name.
There may be a way to do something similar with system.d as well, but I am not well versed in it at all, and if it doesnt allow sending commands to the running console then it would be impossible I believe.
I created a timer to run this command at a specified time and then another one for device reboot. I'll test it to check if it works.
Like I said before, yesterday we had an issue where the cars disappeared, and we were afraid something didn't save correctly and the cars despawned. However, they reappeared once we left the chunk. Now, when I logged in, the cars were still here after the restart. Note that I still didn't run the commands save and quit yesterday. So my question is: is it really that important? I mean, I guess so, but it looks like the server saves automatically, or even when the device reboots, it keeps the progress up to the very end.
Let me just summarize everything so that anyone with similar issue can try the following steps to resolve the issue. Note that this is for people that want to automate the server and are NOT using tmux.
Test the RCON connection with the server via:
Create new .sh file for server restart in server folder, for example rcon_restart.sh:
Make sure the script is executable:
Create new .service file in /etc/systemd/system/
Create new .timer file in /etc/systemd/system/ note that the OnCalendar uses 24h format.
Make sure you adjust all the timers to work together - if your service for start-server.sh starts when system boots up you can skip this but if you restart the server multiple times or don't restart the machine on which the server is running then you'll have to make sure the timers are not intertwining.