STEAM GROUP
Linux Game Server Managers linuxgsm
STEAM GROUP
Linux Game Server Managers linuxgsm
34
IN-GAME
464
ONLINE
Founded
February 9, 2015
d3m0n Jan 17, 2017 @ 7:36am
[Ark] Server warning/broadcast before update and restart
I was wondering if it's possible to send a message to the players automatically X amount of minutes before an update is applied and the server restarted?
Last edited by d3m0n; Jan 17, 2017 @ 7:36am
< >
Showing 1-12 of 12 comments
UltimateByte Jan 19, 2017 @ 9:11am 
There is no easy way currently.
Simon Jan 19, 2017 @ 9:39am 
I was looking into this if there was a way to use some form of linux based rcon for Ark you could submit broadcast message to ingame and use pause commands for the update.sh perhaps ?
UltimateByte Jan 19, 2017 @ 11:28am 
Well, for that matter, you would need to have the ability to connect to RCON in the first place.
Would require some workarounds to make this possible though.
Structure would be:

Update checks if there is a lockfile
if there is one, stop the update process since one is pending
If an update is available
then create a lockfile
connect to rcon
send timed messages until $timerupdate is 0
apply the update
restart the server
Simon Jan 19, 2017 @ 12:01pm 
Originally posted by UltimateByte:
Well, for that matter, you would need to have the ability to connect to RCON in the first place.
Would require some workarounds to make this possible though.
Structure would be:

Update checks if there is a lockfile
if there is one, stop the update process since one is pending
If an update is available
then create a lockfile
connect to rcon
send timed messages until $timerupdate is 0
apply the update
restart the server

Seems quite logical to me.
The part i can't get around is the core Rcon part that hooks into ShooterGameServer. The Rcon module doesn't need any features pure basic headless client process to simply interface with ShooterGameServer process to deliver basic commands connecting to local host on defined rcon port ***** specified from the arkserver script. Could work quite well with existing scripts and even expand the ./arkserver stop command to use this rcon module to Saveworld & exit gracefully....

Simon Jan 19, 2017 @ 12:12pm 
Speaking of which i've just found a post on official Ark forums regarding just this a basic rcon script that connects > executes > disconnects.

Source: http://www.ark-survival.net/en/2015/07/09/rcon-tutorial/
Full script: https://www.ryanschulze.net/archives/1052

Maybe something you can work with or build similar of potentially ?
UltimateByte Jan 19, 2017 @ 1:12pm 
Actually, this is a plan since early stage of LGSM. Just requires someone to get into it.
https://github.com/GameServerManagers/LinuxGSM/issues/299
Simon Jan 19, 2017 @ 1:56pm 
Interesting, I'm going to have a play about with the rcon shell script see what still works or what can be salvaged.
d3m0n Jan 20, 2017 @ 3:30am 
Originally posted by UltimateByte:
Well, for that matter, you would need to have the ability to connect to RCON in the first place.
Would require some workarounds to make this possible though.
Structure would be:

Update checks if there is a lockfile
if there is one, stop the update process since one is pending
If an update is available
then create a lockfile
connect to rcon
send timed messages until $timerupdate is 0
apply the update
restart the server

So what I've done so far and haven't been able to see if it works because I am waiting for an update is I've edited the update_steamcmd.sh script to run a custom script if and when update_steamcmd.sh detects an update. The script runs MCRCON (another script to access rcon via terminal) and only broadcasts the message with timers set. I am assuming (and hoping) what will happen is after the timers finish it will continue with the update.

update_steamcmd.sh
if [ "${status}" != "0" ]; then #### # Broadcast script #### echo -en "Broadcasting to server before restart...\n" fn_script_log_info "Broadcasting to server before restart" sleep 1 broadcast_restart.sh ########### exitbypass=1 command_stop.sh fn_update_steamcmd_dl exitbypass=1 command_start.sh else fn_update_steamcmd_dl fi alert="update" alert.sh

And my broadcast_restart.sh
#!/bin/bash # IP of Ark-Server ServerIP=xxx.xxx.xxx.xxx # RCON-Port of Ark-Server Port=port # Admin Password of Ark-Server Pass=password mcrcon -s -H $ServerIP -P $Port -p $Pass "broadcast AUTOMATIC MESSAGE: The server will be going down for maintenance in 15 minutes." sleep 15m mcrcon -s -H $ServerIP -P $Port -p $Pass "broadcast AUTOMATIC MESSAGE: The server will be going down for maintenance in 10 minutes." sleep 10m mcrcon -s -H $ServerIP -P $Port -p $Pass "broadcast AUTOMATIC MESSAGE: The server will be going down for maintenance in 5 minutes." sleep 5m mcrcon -s -H $ServerIP -P $Port -p $Pass "broadcast AUTOMATIC MESSAGE: The server will be going down for maintenance in 30 seconds." sleep 30 mcrcon -s -H $ServerIP -P $Port -p $Pass "broadcast ..." sleep 5
Last edited by d3m0n; Jan 20, 2017 @ 3:32am
Simon Jan 23, 2017 @ 1:27pm 
@d3m0n how did you get on with your testing here?

I have managed to get this rcon sourcecode script compiled and working on Ubuntu 16.04LTS. Source: http://www.ark-survival.net/en/2015/07/09/rcon-tutorial/

I have done very low-level crude testing so far just initiating broadcast messages / saveworld / listplayers etc... From this I hope to implement this into the update.sh if the server is to go down for update just a simple message with pause will do nothing fancy. Like you've done with broadcast_restart.sh I’ll probably compose something similar using pauses until it saves world then initiates ./arkserver stop to put that lockfile in place so the monitor doesn't restart it whilst updating. Simple, crude but effective I guess.

Screenshot: http://imgur.com/l03of93

./rcon -Prconpassword -a192.168.2.7 -p32330 listplayers
./rcon -Prconpassword -a192.168.2.7 -p32330 broadcast "Server shutdown in 15 minutes for update"
./rcon -Prconpassword -a192.168.2.7 -p32330 saveworld


@UltimateByte would perhaps know best how to integrate this into LGSM properly perhaps using ${rconport} & {rconpassword} variables in arkserver main script. To note also it will only work if the user has RCONEnabled=True defined in the settings ini. With this particular script i had to define the machine IP likely due to an incorrect Hostsfile issue but its a test box that’s had a lot of abuse.
d3m0n Jan 23, 2017 @ 7:00pm 
@Simon Unfortunately when I put my files in the lgsm/functions folder and had linuxgsm functions update on a cronjob it did a Git update and deleted any files not present on the remote Git repo. I just noticed this today so I have to put the files back in another folder.

About what you said, as far as I can see, LinuxGSM is doing all the lock files and stuff when it runs the update script. Even if monitor runs it knows the update script is running. I saw this in my log files. So if I can assume right, it doesn't matter if the update script is running for 30+ mins (Or whatever time), it'll still be locked and the monitor script will know? Here's the logs I am talking about:

Jan 21 00:00:01 ark-server: CHECK: INFO: Using anonymous Steam login. Jan 21 00:00:02 ark-server: MONITOR: ERROR: SteamCMD is currently checking for updates Jan 21 00:00:02 ark-server: UPDATE: INFO: Checking for update: Server logs Jan 21 00:00:03 ark-server: MONITOR: ERROR: command_monitor.sh exiting with code: 2

I also *believe* LinuxGSM already saves the world for you, or has an option to enable/disable it. Again, I assume, literally everything is there just not the broadcast, which makes sense because different games have different ways to broadcast.

Edit: I had some errors in my broadcast script and after debugging have successfully run the script stand alone with the timers. So as long as that script runs in the update_steamcmd.sh and exits clean, there's no reason that update shouldn't be successful along with the broadcast. Now I just have to wait until me or one of my buddies is on my server during an update.

Disclaimer: This is totally me guessing based on my background in programming, I don't have much experience in bash. Edit these files at your own risk.
Last edited by d3m0n; Jan 24, 2017 @ 9:36am
DelMurice Feb 3, 2019 @ 5:47am 
I'm bit late, but in case people are reading this still to get help, I run a Linux Ark Server, and just use crontab to schedule broadcasts and server restart. I compiled rcon in my home directory at /home/user/rcon, so when I used the command
crontab -e
and it goes into the editor I add the line
45 3 * * * /home/user/rcon -P"arkadminpassword" -a127.0.0.1 -p27020 Broadcast Restrting in 15 minutes
and then issue the command
sudo crontab -e
and enter the following to restart the server
0 4 * * * shutdown -r 0
-r means to restart, and the 0 means to do it immediately, since the only people effected are on my ark server and they already got their warning. Mine restarts every morning at 4am. You can search the web for more details about rcon and crontab.
Fritzli Jun 10, 2020 @ 3:59pm 
See at https://github.com/GameServerManagers/LinuxGSM/issues/2922

I add

restart-broadcast ar | Restart the ARK Server with Broadcast on Server 15m 5m 1m. stop-broadcast as | Stop the ARK Server with Broadcast on Server 15m 5m 1m. update-broadcast au | Update the ARK Server with Broadcast on Server 15m 5m 1m.
Last edited by Fritzli; Jun 10, 2020 @ 4:09pm
< >
Showing 1-12 of 12 comments
Per page: 1530 50