-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbroadcast_backup.sh
More file actions
41 lines (35 loc) · 1.44 KB
/
broadcast_backup.sh
File metadata and controls
41 lines (35 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
####################################
# Send a broadcast message to all players on the Ark server
# warning them of an imminent restart using Rcon.
#
# PD: This script requires the rcon binary to be located
# in the "rcon-client" folder and properly configured.
#
# Ensure this script has execution permissions:
# chmod +x broadcast_backup.sh
#
# RCON client used: https://github.com/gorcon/rcon-cli, I downloaded the binary from the releases page.
####################################
# Path to the rcon client binary
rcon_client_path="/home/ark-server/rcon-client/rcon"
# RCON server configuration
rcon_host="127.0.0.1" # Replace with your server's IP if not localhost
rcon_port="32330" # RCON port configured in GameUserSettings.ini
rcon_password="your_password_here" # Replace with your ServerAdminPassword
# Message to broadcast
message="Atencion, supervivientes! El servidor se reiniciara en 10 minutos, ponganse en un lugar seguro y tomen foto de inventario."
# Check if the rcon binary exists
if [[ ! -x "$rcon_client_path" ]]; then
echo "Error: Rcon binary not found or not executable at $rcon_client_path"
exit 1
fi
# Send the broadcast message using rcon
$rcon_client_path -a $rcon_host:$rcon_port -p $rcon_password "broadcast $message"
# Check if the command was successful
if [[ $? -eq 0 ]]; then
echo "Message sent: $message"
else
echo "Error: Failed to send the message. Check your RCON configuration."
exit 1
fi