-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring of shell-scripts and docker-based files, #120 also added …
…the ability to send start and stop webhook notifies
- Loading branch information
Showing
10 changed files
with
445 additions
and
379 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Function to start supercronic and load crons from cronlist | ||
function setup_crons() { | ||
touch cronlist | ||
if [[ -n $BACKUP_ENABLED ]] && [[ $BACKUP_ENABLED == "true" ]]; then | ||
echo "$BACKUP_CRON_EXPRESSION /backupmanager.sh" >> cronlist | ||
fi | ||
/usr/local/bin/supercronic cronlist & | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Function to install the gameserver | ||
function install_server() { | ||
# force a fresh install of all | ||
echo ">>> Doing a fresh install of the gameserver" | ||
if [[ -n $WEBHOOK_ENABLED ]] && [[ $WEBHOOK_ENABLED == "true" ]]; then | ||
send_webhook_notification "Installing server" "Server is beeing installed" "$WEBHOOK_INFO_COLOR" | ||
fi | ||
/home/steam/steamcmd/steamcmd.sh +force_install_dir "$GAME_PATH" +login anonymous +app_update 2394010 validate +quit | ||
} | ||
|
||
# Function to update the gameserver | ||
function update_server() { | ||
# force an update and validation | ||
if [[ -n $STEAMCMD_VALIDATE_FILES ]] && [[ $STEAMCMD_VALIDATE_FILES == "true" ]]; then | ||
echo ">>> Doing an update and validate of the gameserver files" | ||
if [[ -n $WEBHOOK_ENABLED ]] && [[ $WEBHOOK_ENABLED == "true" ]]; then | ||
send_webhook_notification "Updating server" "Server is beeing updated and validated" "$WEBHOOK_INFO_COLOR" | ||
fi | ||
/home/steam/steamcmd/steamcmd.sh +force_install_dir "$GAME_PATH" +login anonymous +app_update 2394010 validate +quit | ||
else | ||
echo ">>> Doing an update of the gameserver files" | ||
if [[ -n $WEBHOOK_ENABLED ]] && [[ $WEBHOOK_ENABLED == "true" ]]; then | ||
send_webhook_notification "Updating server" "Server is beeing updated" "$WEBHOOK_INFO_COLOR" | ||
fi | ||
/home/steam/steamcmd/steamcmd.sh +force_install_dir "$GAME_PATH" +login anonymous +app_update 2394010 +quit | ||
fi | ||
} |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Function to check if the default passwords are replaced | ||
function check_for_default_credentials() { | ||
echo ">>> Checking for existence of default credentials" | ||
if [[ -n $ADMIN_PASSWORD ]] && [[ $ADMIN_PASSWORD == "adminPasswordHere" ]]; then | ||
echo ">>> Error: Security thread detected: Please change the default admin password. Aborting server start ..." | ||
exit 1 | ||
fi | ||
if [[ -n $SERVER_PASSWORD ]] && [[ $SERVER_PASSWORD == "serverPasswordHere" ]]; then | ||
echo ">>> Error: Security thread detected: Please change the default server password. Aborting server start ..." | ||
exit 1 | ||
fi | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Function to generate JSON data for the Discord message | ||
# Webpage for COLOR-Calculation - https://www.spycolor.com/ | ||
# IMPORTANT: Dont use Hex-Colors! Go to the page search for the Hex-Color. | ||
# After that add the DECIMAL-Represenetation to the color field or it will break! | ||
generate_post_data() { | ||
cat <<EOF | ||
{ | ||
"content": "", | ||
"embeds": [{ | ||
"title": "$1", | ||
"description": "$2", | ||
"color": "$3" | ||
}] | ||
} | ||
EOF | ||
} | ||
|
||
# Function to send a notification to a webhook | ||
send_webhook_notification() { | ||
local title="$1" | ||
local description="$2" | ||
local color="$3" | ||
|
||
# Debug Curl | ||
#curl --ssl-no-revoke -H "Content-Type: application/json" -X POST -d "$(generate_post_data "$title" "$description" "$color")" "$WEBHOOK_URL" | ||
# Prod Curl | ||
curl --silent --ssl-no-revoke -H "Content-Type: application/json" -X POST -d "$(generate_post_data "$title" "$description" "$color")" "$WEBHOOK_URL" | ||
} |
Oops, something went wrong.