Created
January 26, 2024 18:36
-
-
Save Illvili/ad7cef245fd1f6b7057b5284eaba46a6 to your computer and use it in GitHub Desktop.
PalWorld mem report with rcon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
cd /home/lighthouse/rcon | |
rss=$(ps aux | grep PalServer-Linux | grep -v grep | awk '{print $6"000"}') | |
max_mem=15000000000 | |
percent=$(bc <<< "scale=2; $rss*100/$max_mem") | |
p_len=30 | |
nth=$(($rss*$p_len/$max_mem)) | |
p_full=############################## | |
p_empty=______________________________ | |
./rcon "broadcast [${p_full:0:$nth}${p_empty:$nth:$p_len}]$percent%@$(date '+%H:%M')" | |
if (( $(bc <<<"$percent > 90") )); then | |
./rcon "broadcast /////////////////////WARNING///////////////////" | |
./rcon "broadcast //THE_SERVER_WILL_SOON_RESTART//" | |
./rcon "broadcast /////////////////////WARNING///////////////////" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment