Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
enhancing log mnagemtn scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
suparious committed Aug 2, 2021
1 parent 34389ab commit 4af610e
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 74 deletions.
12 changes: 5 additions & 7 deletions defaults/0_wipe_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ source ${HOME}/solidrust.net/defaults/funct_update.sh

case "$1" in
now | fast | quick)
echo "performing a Quick Wipe"
initialize_srt
echo "performing a Quick Wipe" | tee -a ${LOGS}
stop_rust_now
wipe_map
change_seed
Expand All @@ -22,11 +22,10 @@ now | fast | quick)
;;

force | forcewipe | facepunch)
echo "performing a Facepunch Force-wipe"
initialize_srt
update_repo
initialize_srt
echo "performing a Facepunch Force-wipe" | tee -a ${LOGS}
notification
update_repo
update_server
update_mods
update_configs
Expand All @@ -43,11 +42,10 @@ force | forcewipe | facepunch)
;;

*)
echo "performing a Standard Wipe"
initialize_srt
update_repo
initialize_srt
echo "performing a Standard Wipe" | tee -a ${LOGS}
notification
update_repo
update_server
update_mods
update_configs
Expand Down
21 changes: 0 additions & 21 deletions defaults/20_sync_all.sh

This file was deleted.

97 changes: 51 additions & 46 deletions defaults/funct_common.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function initialize_srt () {
function initialize_srt() {
source ${HOME}/solidrust.net/defaults/env_vars.sh
source ${HOME}/solidrust.net/servers/${HOSTNAME}/env_vars.sh
alias rcon="${GAME_ROOT}/rcon -c ${HOME}/solidrust.net/defaults/rcon.yaml"
Expand All @@ -9,7 +9,7 @@ function initialize_srt () {
source ${HOME}/solidrust.net/defaults/funct_update.sh
}

function backup_s3 () {
function backup_s3() {
if [ -f "${GAME_ROOT}/rcon" ]; then
echo "rcon binary found, saving world..." | tee -a ${LOGS}
${GAME_ROOT}/rcon --log ${LOGS} --config ${RCON_CFG} "server.writecfg"
Expand All @@ -33,102 +33,107 @@ function backup_s3 () {
done
}

function save_ebs () {
function save_ebs() {
echo "save current game folder to instance EBS" | tee -a ${LOGS}
mkdir -p ${HOME}/game_root
rsync -ra --delete "${GAME_ROOT}/" "${HOME}/game_root" | tee -a ${LOGS}
mkdir -p ${HOME}/nvme_root
rsync -ra --delete "${GAME_ROOT}/" "${HOME}/nvme_root" | tee -a ${LOGS}
}

function restore_ebs () {
function restore_ebs() {
echo "save current game folder to instance EBS" | tee -a ${LOGS}
rsync -ra --delete "${HOME}/game_root/" "${GAME_ROOT}"
rsync -ra --delete "${HOME}/nvme_root/" "${GAME_ROOT}"
}

function start_rust () {
function start_rust() {
echo "Start RustDedicated game service" | tee -a ${LOGS}
# enter game root
cd ${GAME_ROOT}

if [ ${CUSTOM_MAP} = "enabled" ]; then
echo "Custom Maps enabled: ${CUSTOM_MAP_URL}" | tee -a ${LOGS}
sleep 2
./RustDedicated -batchmode -nographics -silent-crashes -logfile 2>&1 ${SERVER_LOGS} \
+server.ip 0.0.0.0 \
+server.port 28015 \
+rcon.ip 0.0.0.0 \
+rcon.port 28016 \
+server.tickrate 30 \
+app.publicip ${SERVER_IP} \
+app.port 28082 \
+rcon.web 1 \
+rcon.password "NOFAGS" \
+server.identity "solidrust" \
+server.levelurl ${CUSTOM_MAP_URL} \
+server.logoimage "https://solidrust.net/images/SoldRust_Logo.png" &
./RustDedicated -batchmode -nographics -silent-crashes -logfile ${SERVER_LOGS} \
+server.ip 0.0.0.0 \
+server.port 28015 \
+rcon.ip 0.0.0.0 \
+rcon.port 28016 \
+server.tickrate 30 \
+app.publicip ${SERVER_IP} \
+app.port 28082 \
+rcon.web 1 \
+rcon.password "NOFAGS" \
+server.identity "solidrust" \
+server.levelurl ${CUSTOM_MAP_URL} \
+server.logoimage "https://solidrust.net/images/SoldRust_Logo.png" 2>&1 \
;

else

echo "Using ${WORLD_SIZE} Procedural map with seed: ${SEED} " | tee -a ${LOGS}
sleep 2
./RustDedicated -batchmode -nographics -silent-crashes -logfile 2>&1 ${SERVER_LOGS} \
+server.ip 0.0.0.0 \
+server.port 28015 \
+rcon.ip 0.0.0.0 \
+rcon.port 28016 \
+server.tickrate 30 \
+app.publicip ${SERVER_IP} \
+app.port 28082 \
+rcon.web 1 \
+rcon.password "NOFAGS" \
+server.identity "solidrust" \
+server.level "Procedural Map" \
+server.seed ${SEED} \
+server.worldsize ${WORLD_SIZE} \
+server.logoimage "https://solidrust.net/images/SoldRust_Logo.png" &
./RustDedicated -batchmode -nographics -silent-crashes -logfile ${SERVER_LOGS} \
+server.ip 0.0.0.0 \
+server.port 28015 \
+rcon.ip 0.0.0.0 \
+rcon.port 28016 \
+server.tickrate 30 \
+app.publicip ${SERVER_IP} \
+app.port 28082 \
+rcon.web 1 \
+rcon.password "NOFAGS" \
+server.identity "solidrust" \
+server.level "Procedural Map" \
+server.seed ${SEED} \
+server.worldsize ${WORLD_SIZE} \
+server.logoimage "https://solidrust.net/images/SoldRust_Logo.png" 2>&1 \
;

fi

# Launch game server
echo "===> Touching my peepee..." | tee -a ${LOGS}
sleep 3
tail -n 10 ${SERVER_LOGS}
echo "Delaying for about 8mins while service loads" | tee -a ${LOGS}
sleep 120
tail -n 10 ${SERVER_LOGS}
echo "Delaying for 6mins while service loads" | tee -a ${LOGS}
echo "Delaying for 6mins while service loads" | tee -a ${LOGS}
sleep 120
tail -n 10 ${SERVER_LOGS}
echo "Delaying for 4mins while service loads" | tee -a ${LOGS}
echo "Delaying for 4mins while service loads" | tee -a ${LOGS}
sleep 60
tail -n 10 ${SERVER_LOGS}
echo "Delaying for 3mins while service loads" | tee -a ${LOGS}
echo "Delaying for 3mins while service loads" | tee -a ${LOGS}
sleep 60
tail -n 10 ${SERVER_LOGS}
echo "Delaying for 2mins while service loads" | tee -a ${LOGS}
echo "Delaying for 2mins while service loads" | tee -a ${LOGS}
sleep 60
tail -n 10 ${SERVER_LOGS}
echo "Delaying for 1mins while service loads" | tee -a ${LOGS}
echo "Delaying for 1mins while service loads" | tee -a ${LOGS}
sleep 60
tail -n 10 ${SERVER_LOGS}
echo "Should be ready for action" | tee -a ${LOGS}
}

function stop_rust () {
function stop_rust() {
echo "Stop RustDedicated game service" | tee -a ${LOGS}
${GAME_ROOT}/rcon --log ${LOGS} --config ${RCON_CFG} "restart 30"
}

function stop_rust_now () {
function stop_rust_now() {
echo "Stop RustDedicated game service" | tee -a ${LOGS}
${GAME_ROOT}/rcon --log ${LOGS} --config ${RCON_CFG} "restart 1"
}

function show_logs () {
function show_logs() {
#find . -type f -exec grep -l samplestring {} \;
tail -n 20 -F "${HOME}/SolidRusT.log" "${GAME_ROOT}/RustDedicated.log" "${GAME_ROOT}/rcon-default.log"
}

function hot_plugs () {
function hot_plugs() {
export REPORTS="${GAME_ROOT}/oxide/data/PerformanceMonitor/Reports"
export LATEST_REPORT=$(ls -1tr ${REPORTS}/*/* | tail -n 1)


}

echo "SRT Common Functions initialized" | tee -a ${LOGS}
20 changes: 20 additions & 0 deletions defaults/logrotate.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,24 @@
missingok
maxage 3
dateext
}

/game/oxide/logs/*.txt {
size 200k
copytruncate
rotate 5
compress
missingok
maxage 3
dateext
}

/game/oxide/logs/*/*.txt {
size 200k
copytruncate
rotate 5
compress
missingok
maxage 3
dateext
}

0 comments on commit 4af610e

Please sign in to comment.