Skip to content

Commit

Permalink
refactored Dockerfile, managers, wrapper and scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jammsen committed Feb 11, 2024
1 parent bb8e0a1 commit 285982e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 28 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ COPY --chown=steam:steam --chmod=755 includes/ /includes
COPY --chown=steam:steam --chmod=755 configs/rcon.yaml /home/steam/steamcmd/rcon.yaml
COPY --chown=steam:steam --chmod=755 entrypoint.sh /

RUN ln -s /scripts/backupmanager.sh /usr/local/bin/backupmanager \
&& ln -s /scripts/backup.sh /usr/local/bin/backup \
RUN ln -s /scripts/backupmanager.sh /usr/local/bin/backup \
&& ln -s /scripts/rconcli.sh /usr/local/bin/rconcli

# Install minimum required packages for dedicated server
Expand Down
2 changes: 1 addition & 1 deletion includes/cron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
function setup_crons() {
echo "" > cronlist
if [[ -n ${BACKUP_ENABLED} ]] && [[ ${BACKUP_ENABLED} == "true" ]]; then
echo "${BACKUP_CRON_EXPRESSION} backupmanager --create" >> cronlist
echo "${BACKUP_CRON_EXPRESSION} backup create" >> cronlist
fi
/usr/local/bin/supercronic -passthrough-logs cronlist &
ei ">>> Supercronic started"
Expand Down
2 changes: 1 addition & 1 deletion includes/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function fresh_install_server() {

function update_server() {
if [[ -n $STEAMCMD_VALIDATE_FILES ]] && [[ $STEAMCMD_VALIDATE_FILES == "true" ]]; then
ei ">>> Doing an update and validate of the gameserver files..."
ei ">>> Doing an update with validation of the gameserver files..."
if [[ -n $WEBHOOK_ENABLED ]] && [[ $WEBHOOK_ENABLED == "true" ]]; then
send_update_and_validate_notification
fi
Expand Down
9 changes: 0 additions & 9 deletions scripts/backup.sh

This file was deleted.

24 changes: 12 additions & 12 deletions scripts/backupmanager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ LOCAL_BACKUP_RETENTION_AMOUNT_TO_KEEP=${BACKUP_RETENTION_AMOUNT_TO_KEEP} # Numbe
function print_usage() {
script_name=$(basename "$0")
echo "Usage:"
echo " ${script_name} --create"
echo " ${script_name} --list [number_of_entries]"
echo " ${script_name} --clean [number_to_keep]"
echo " ${script_name} --help"
echo " ${script_name} create"
echo " ${script_name} list [number_of_entries]"
echo " ${script_name} clean [number_to_keep]"
echo " ${script_name} help"
echo ""
echo "Options:"
echo " --create Create a backup"
echo " --list [number_to_list] List the backup files. If number_to_list isn't"
echo " create Create a backup"
echo " list [number_to_list] List the backup files. If number_to_list isn't"
echo " provided, all backup files will be listed"
echo " --clean [number_to_keep] Deletes old backups keeping the number_to_keep"
echo " clean [number_to_keep] Deletes old backups keeping the number_to_keep"
echo " most recent backups. If number_to_keep isn't"
echo " provided, keep 30 most recent backups"
echo " --help Display this help message"
echo " help Display this help message"
echo ""
echo "Arguments:"
echo " number_to_list (optional) The number of backup files to list."
Expand All @@ -46,15 +46,15 @@ function parse_arguments() {

# Evaluate the command
case "$1" in
--create)
create)
if [ ${#} -ne 1 ]; then
ee ">>> Invalid number of arguments for 'create'"
print_usage
exit 1
fi
create_backup
;;
--list)
list)
if [ ${#} -gt 2 ]; then
ee ">>> Invalid number of arguments for 'list'"
print_usage
Expand All @@ -70,7 +70,7 @@ function parse_arguments() {

list_backups "${number_to_list}"
;;
--clean)
clean)
if [ ${#} -gt 2 ]; then
ee ">>> Invalid number of arguments for 'clean'"
print_usage
Expand All @@ -86,7 +86,7 @@ function parse_arguments() {

clean_backups "${num_backup_entries}"
;;
--help)
help)
if [ ${#} -ne 1 ]; then
ee ">>> Invalid number of arguments for 'help'"
print_usage
Expand Down
7 changes: 4 additions & 3 deletions scripts/rconcli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ run_rcon_cli() {
ee ">>> RCON is not enabled. Aborting RCON command ..."
exit
fi
ei "${message}"
output=$(rconcli -c /configs/rcon.yaml "${cmd}")
ei "> RCON: ${output}"
ei "> Sending: ${cmd} ${message}"
output=$(rcon -c "$RCON_CONFIG_FILE" "${cmd}")
ei "> RCON-Ouput:"
ei "${output}"
}

run_rcon_cli "$@"

0 comments on commit 285982e

Please sign in to comment.