Skip to content

Commit

Permalink
Revert "fix(messages): fix some messages not using newline correctly (#…
Browse files Browse the repository at this point in the history
…2772)"

This reverts commit 3bd64bb.
  • Loading branch information
dgibbs64 committed Mar 28, 2020
1 parent 4a78269 commit 1cc5d3a
Show file tree
Hide file tree
Showing 24 changed files with 60 additions and 47 deletions.
16 changes: 8 additions & 8 deletions lgsm/functions/alert.sh
Expand Up @@ -118,7 +118,7 @@ elif [ "${discordalert}" != "on" ]&&[ "${function_selfname}" == "command_test_al
fn_script_log_warn "Discord alerts not enabled"
elif [ -z "${discordtoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
fn_print_error "Discord token not set"
echo -e "* https://docs.linuxgsm.com/alerts/discord"
echo -e " * https://docs.linuxgsm.com/alerts/discord"
fn_script_error "Discord token not set"
fi

Expand All @@ -139,7 +139,7 @@ elif [ "${iftttalert}" != "on" ]&&[ "${function_selfname}" == "command_test_aler
fn_script_log_warn "IFTTT alerts not enabled"
elif [ -z "${ifttttoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
fn_print_error "IFTTT token not set"
echo -e "* https://docs.linuxgsm.com/alerts/ifttt"
echo -e " * https://docs.linuxgsm.com/alerts/ifttt"
fn_script_error "IFTTT token not set"
fi

Expand All @@ -150,7 +150,7 @@ elif [ "${mailgunalert}" != "on" ]&&[ "${function_selfname}" == "command_test_al
fn_script_log_warn "Mailgun alerts not enabled"
elif [ -z "${mailguntoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
fn_print_error "Mailgun token not set"
echo -e "* https://docs.linuxgsm.com/alerts/mailgun"
echo -e " * https://docs.linuxgsm.com/alerts/mailgun"
fn_script_error "Mailgun token not set"
fi

Expand All @@ -161,7 +161,7 @@ elif [ "${pushbulletalert}" != "on" ]&&[ "${function_selfname}" == "command_test
fn_script_log_warn "Pushbullet alerts not enabled"
elif [ -z "${pushbullettoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
fn_print_error "Pushbullet token not set"
echo -e "* https://docs.linuxgsm.com/alerts/pushbullet"
echo -e " * https://docs.linuxgsm.com/alerts/pushbullet"
fn_script_error "Pushbullet token not set"
fi

Expand All @@ -172,7 +172,7 @@ elif [ "${pushoveralert}" != "on" ]&&[ "${function_selfname}" == "command_test_a
fn_script_log_warn "Pushover alerts not enabled"
elif [ -z "${pushovertoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
fn_print_error "Pushover token not set"
echo -e "* https://docs.linuxgsm.com/alerts/pushover"
echo -e " * https://docs.linuxgsm.com/alerts/pushover"
fn_script_error "Pushover token not set"
fi

Expand All @@ -183,11 +183,11 @@ elif [ "${telegramalert}" != "on" ]&&[ "${function_selfname}" == "command_test_a
fn_script_log_warn "Telegram Messages not enabled"
elif [ -z "${telegramtoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
fn_print_error "Telegram token not set."
echo -e "* https://docs.linuxgsm.com/alerts/telegram"
echo -e " * https://docs.linuxgsm.com/alerts/telegram"
fn_script_error "Telegram token not set."
elif [ -z "${telegramchatid}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
fn_print_error "Telegram chat id not set."
echo -e "* https://docs.linuxgsm.com/alerts/telegram"
echo -e " * https://docs.linuxgsm.com/alerts/telegram"
fn_script_error "Telegram chat id not set."
fi

Expand All @@ -198,6 +198,6 @@ elif [ "${slackalert}" != "on" ]&&[ "${function_selfname}" == "command_test_aler
fn_script_log_warn "Slack alerts not enabled"
elif [ -z "${slacktoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
fn_print_error "Slack token not set"
echo -e "* https://docs.linuxgsm.com/alerts/slack"
echo -e " * https://docs.linuxgsm.com/alerts/slack"
fn_script_error "Slack token not set"
fi
4 changes: 2 additions & 2 deletions lgsm/functions/alert_discord.sh
Expand Up @@ -58,9 +58,9 @@ fn_print_dots "Sending Discord alert"
discordsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "$json" | jq -c .)" "${discordwebhook}")

if [ "${discordsend}" ]; then
fn_print_fail "Sending Discord alert: ${discordsend}"
fn_print_fail_nl "Sending Discord alert: ${discordsend}"
fn_script_log_fatal "Sending Discord alert: ${discordsend}"
else
fn_print_ok "Sending Discord alert"
fn_print_ok_nl "Sending Discord alert"
fn_script_log_pass "Sending Discord alert"
fi
4 changes: 2 additions & 2 deletions lgsm/functions/alert_email.sh
Expand Up @@ -18,9 +18,9 @@ else
fi
exitcode=$?
if [ "${exitcode}" == "0" ]; then
fn_print_ok "Sending Email alert: ${email}"
fn_print_ok_nl "Sending Email alert: ${email}"
fn_script_log_pass "Sending Email alert: ${email}"
else
fn_print_fail "Sending Email alert: ${email}"
fn_print_fail_nl "Sending Email alert: ${email}"
fn_script_log_fatal "Sending Email alert: ${email}"
fi
4 changes: 2 additions & 2 deletions lgsm/functions/alert_ifttt.sh
Expand Up @@ -21,9 +21,9 @@ fn_print_dots "Sending IFTTT alert"
iftttsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d """${json}""" "https://maker.ifttt.com/trigger/${iftttevent}/with/key/${ifttttoken}" | grep "Bad Request")

if [ "${iftttsend}" ]; then
fn_print_fail "Sending IFTTT alert: ${pushbulletsend}"
fn_print_fail_nl "Sending IFTTT alert: ${pushbulletsend}"
fn_script_log_fatal "Sending IFTTT alert: ${pushbulletsend}"
else
fn_print_ok "Sending IFTTT alert"
fn_print_ok_nl "Sending IFTTT alert"
fn_script_log_pass "Sent IFTTT alert"
fi
4 changes: 2 additions & 2 deletions lgsm/functions/alert_mailgun.sh
Expand Up @@ -19,9 +19,9 @@ mailgunsend=$(curl -s --user "api:${mailguntoken}" \
-F text="$(cat "${alertlog}")" "https://api.mailgun.net/v3/${mailgundomain}/messages")

if [ -z "${mailgunsend}" ]; then
fn_print_fail "Sending Email alert: Mailgun: ${email}"
fn_print_fail_nl "Sending Email alert: Mailgun: ${email}"
fn_script_log_fatal "Sending Email alert: Mailgun: ${email}"
else
fn_print_ok "Sending Email alert: Mailgun: ${email}"
fn_print_ok_nl "Sending Email alert: Mailgun: ${email}"
fn_script_log_pass "Sending Email alert: Mailgun: ${email}"
fi
4 changes: 2 additions & 2 deletions lgsm/functions/alert_pushbullet.sh
Expand Up @@ -22,9 +22,9 @@ fn_print_dots "Sending Pushbullet alert"
pushbulletsend=$(curl -sSL -u """${pushbullettoken}"":" -H "Content-Type: application/json" -X POST -d """${json}""" "https://api.pushbullet.com/v2/pushes" | grep "error_code")

if [ "${pushbulletsend}" ]; then
fn_print_fail "Sending Pushbullet alert: ${pushbulletsend}"
fn_print_fail_nl "Sending Pushbullet alert: ${pushbulletsend}"
fn_script_log_fatal "Sending Pushbullet alert: ${pushbulletsend}"
else
fn_print_ok "Sending Pushbullet alert"
fn_print_ok_nl "Sending Pushbullet alert"
fn_script_log_pass "Sent Pushbullet alert"
fi
4 changes: 2 additions & 2 deletions lgsm/functions/alert_pushover.sh
Expand Up @@ -26,9 +26,9 @@ fi
pushoversend=$(curl -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alertemoji} ${alertsubject} ${alertemoji}" -F message=" <b>Message</b><br>${alertbody}<br><br><b>Game</b><br>${gamename}<br><br><b>Server name</b><br>${servername}<br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>Server IP</b><br><a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a><br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)

if [ "${pushoversend}" ]; then
fn_print_fail "Sending Pushover alert: ${pushoversend}"
fn_print_fail_nl "Sending Pushover alert: ${pushoversend}"
fn_script_log_fatal "Sending Pushover alert: ${pushoversend}"
else
fn_print_ok "Sending Pushover alert"
fn_print_ok_nl "Sending Pushover alert"
fn_script_log_pass "Sent Pushover alert"
fi
4 changes: 2 additions & 2 deletions lgsm/functions/alert_slack.sh
Expand Up @@ -72,9 +72,9 @@ fn_print_dots "Sending Slack alert"
slacksend=$(curl -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "$json" | jq -c .)" "${slackwebhook}")

if [ "${slacksend}" == "ok" ]; then
fn_print_ok "Sending Slack alert"
fn_print_ok_nl "Sending Slack alert"
fn_script_log_pass "Sending Slack alert"
else
fn_print_fail "Sending Slack alert: ${slacksend}"
fn_print_fail_nl "Sending Slack alert: ${slacksend}"
fn_script_log_fatal "Sending Slack alert: ${slacksend}"
fi
4 changes: 2 additions & 2 deletions lgsm/functions/alert_telegram.sh
Expand Up @@ -21,9 +21,9 @@ fn_print_dots "Sending Telegram alert"
telegramsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d """${json}""" "https://api.telegram.org/bot${telegramtoken}/sendMessage" "${curlcustomstring}" | grep "error_code")

if [ "${telegramsend}" ]; then
fn_print_fail "Sending Telegram alert: ${telegramsend}"
fn_print_fail_nl "Sending Telegram alert: ${telegramsend}"
fn_script_log_fatal "Sending Telegram alert: ${telegramsend}"
else
fn_print_ok "Sending Telegram alert"
fn_print_ok_nl "Sending Telegram alert"
fn_script_log_pass "Sent Telegram alert"
fi
2 changes: 1 addition & 1 deletion lgsm/functions/check_ip.sh
Expand Up @@ -80,7 +80,7 @@ if [ "${travistest}" != "1" ]; then
core_exit.sh
fi
else
fn_print_info "Check IP: ${getip}"
fn_print_info_nl "Check IP: ${getip}"
fn_script_log_info "IP automatically set as: ${getip}"
ip="${getip}"
fi
Expand Down
23 changes: 11 additions & 12 deletions lgsm/functions/command_backup.sh
Expand Up @@ -54,8 +54,7 @@ fn_backup_init(){
else
daysago="${lastbackupdaysago} days ago"
fi
echo -en "\n"
echo -e "* Previous backup was created ${daysago}, total size ${lastbackupsize}"
echo -e " * Previous backup was created ${daysago}, total size ${lastbackupsize}"
fi
}

Expand All @@ -69,12 +68,12 @@ fn_backup_stop_server(){
elif [ "${stoponbackup}" == "off" ]; then
serverstopped="no"
fn_print_warn_nl "${selfname} is currently running"
echo -e "* Although unlikely; creating a backup while ${selfname} is running might corrupt the backup."
echo -e " * Although unlikely; creating a backup while ${selfname} is running might corrupt the backup."
fn_script_log_warn "${selfname} is currently running"
fn_script_log_warn "Although unlikely; creating a backup while ${selfname} is running might corrupt the backup"
# Server is running and will be stopped if stoponbackup=on or unset.
else
fn_print_warn "${selfname} will be stopped during the backup"
fn_print_warn_nl "${selfname} will be stopped during the backup"
fn_script_log_warn "${selfname} will be stopped during the backup"
serverstopped="yes"
exitbypass=1
Expand Down Expand Up @@ -135,7 +134,7 @@ fn_backup_compression(){

# Check that excludedir is a valid path.
if [ ! -d "${excludedir}" ] ; then
fn_print_fail "Problem identifying the previous backup directory for exclusion."
fn_print_fail_nl "Problem identifying the previous backup directory for exclusion."
fn_script_log_fatal "Problem identifying the previous backup directory for exclusion"
core_exit.sh
fi
Expand All @@ -146,11 +145,11 @@ fn_backup_compression(){
fn_print_fail_eol
fn_script_log_fatal "Backup in progress: FAIL"
echo -e "${tarcmd}" | tee -a "${lgsmlog}"
fn_print_fail "Starting backup"
fn_print_fail_nl "Starting backup"
fn_script_log_fatal "Starting backup"
else
fn_print_ok_eol
fn_print_ok "Completed: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
fn_print_ok_nl "Completed: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
fn_script_log_pass "Backup created: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
fi
# Remove lock file
Expand All @@ -171,30 +170,30 @@ fn_backup_prune(){
if [ "${backupquotadiff}" -gt "0" ]||[ "${backupsoudatedcount}" -gt "0" ]; then
fn_print_dots "Pruning"
fn_script_log_info "Backup pruning activated"
fn_print_ok "Pruning"
fn_print_ok_nl "Pruning"
# If maxbackups greater or equal to backupsoutdatedcount, then it is over maxbackupdays.
if [ "${backupquotadiff}" -ge "${backupsoudatedcount}" ]; then
# Display how many backups will be cleared.
echo -e "* Pruning: ${backupquotadiff} backup(s) has exceeded the ${maxbackups} backups limit"
echo -e " * Pruning: ${backupquotadiff} backup(s) has exceeded the ${maxbackups} backups limit"
fn_script_log_info "Pruning: ${backupquotadiff} backup(s) has exceeded the ${maxbackups} backups limit"
fn_sleep_time
fn_print_dots "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_script_log_info "Pruning: Clearing ${backupquotadiff} backup(s)"
# Clear backups over quota.
find "${backupdir}"/ -type f -name "*.tar.gz" -printf '%T@ %p\n' | sort -rn | tail -${backupquotadiff} | cut -f2- -d" " | xargs rm
fn_print_ok "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_print_ok_nl "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_script_log_pass "Pruning: Cleared ${backupquotadiff} backup(s)"
# If maxbackupdays is used over maxbackups.
elif [ "${backupquotadiff}" -lt "${backupsoudatedcount}" ]; then
# Display how many backups will be cleared.
echo -e "* Pruning: ${backupsoudatedcount} backup(s) are older than ${maxbackupdays} days."
echo -e " * Pruning: ${backupsoudatedcount} backup(s) are older than ${maxbackupdays} days."
fn_script_log_info "Pruning: ${backupsoudatedcount} backup(s) older than ${maxbackupdays} days."
fn_sleep_time
fn_print_dots "Pruning: Clearing ${backupquotadiff} backup(s)."
fn_script_log_info "Pruning: Clearing ${backupquotadiff} backup(s)"
# Clear backups over quota
find "${backupdir}"/ -type f -mtime +"${maxbackupdays}" -exec rm -f {} \;
fn_print_ok "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_print_ok_nl "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_script_log_pass "Pruning: Cleared ${backupquotadiff} backup(s)"
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion lgsm/functions/command_donate.sh
Expand Up @@ -16,8 +16,8 @@ echo -e "Been using LinuxGSM?"
echo -e "Consider donating to support development."
echo -e ""
echo -e "* ${lightblue}Patreon:${default} https://linuxgsm.com/patreon"
echo -e "* ${lightblue}GitHub:${default} https://github.com/sponsors/dgibbs64"
echo -e "* ${lightblue}PayPal:${default} https://linuxgsm.com/paypal"
echo -e "* ${lightblue}Ko-Fi:${default} https://linuxgsm.com/ko-fi"
echo -e ""
echo -e "LinuxGSM est. 2012"

Expand Down
2 changes: 1 addition & 1 deletion lgsm/functions/command_start.sh
Expand Up @@ -170,7 +170,7 @@ fn_print_dots "${servername}"
# Is the server already started.
# $status comes from check_status.sh, which is run by check.sh for this command
if [ "${status}" != "0" ]; then
fn_print_info "${servername} is already running"
fn_print_info_nl "${servername} is already running"
fn_script_log_error "${servername} is already running"
if [ -z "${exitbypass}" ]; then
core_exit.sh
Expand Down
2 changes: 1 addition & 1 deletion lgsm/functions/command_stop.sh
Expand Up @@ -211,7 +211,7 @@ fn_stop_tmux(){
fn_sleep_time
check_status.sh
if [ "${status}" == "0" ]; then
fn_print_ok "${servername}"
fn_print_ok_nl "${servername}"
fn_script_log_pass "Stopped ${servername}"
else
fn_print_fail_nl "Unable to stop ${servername}"
Expand Down
1 change: 1 addition & 0 deletions lgsm/functions/command_test_alert.sh
Expand Up @@ -13,4 +13,5 @@ check.sh
info_config.sh
alert="test"
alert.sh

core_exit.sh
4 changes: 2 additions & 2 deletions lgsm/functions/command_validate.sh
Expand Up @@ -30,10 +30,10 @@ fn_validation(){
${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"
fi
if [ $? != 0 ]; then
fn_print_fail "Validating files: SteamCMD"
fn_print_fail_nl "Validating files: SteamCMD"
fn_script_log_fatal "Validating files: SteamCMD: FAIL"
else
fn_print_ok "Validating files: SteamCMD"
fn_print_ok_nl "Validating files: SteamCMD"
fn_script_log_pass "Validating files: SteamCMD: OK"
fi
fix.sh
Expand Down
2 changes: 1 addition & 1 deletion lgsm/functions/fix.sh
Expand Up @@ -17,7 +17,7 @@ fn_fix_msg_start(){

fn_fix_msg_start_nl(){
fn_print_dots "Applying ${fixname} fix: ${gamename}"
fn_print_info_nl "Applying ${fixname} fix: ${gamename}"
fn_print_info "Applying ${fixname} fix: ${gamename}"
fn_script_log_info "Applying ${fixname} fix: ${gamename}"
}

Expand Down
2 changes: 2 additions & 0 deletions lgsm/functions/update_factorio.sh
Expand Up @@ -72,6 +72,7 @@ fn_update_factorio_compare(){
remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]')
if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "Update available"
echo -e "* Local build: ${red}${localbuild} ${factorioarch}${default}"
echo -e "* Remote build: ${green}${remotebuild} ${factorioarch}${default}"
Expand Down Expand Up @@ -119,6 +120,7 @@ fn_update_factorio_compare(){
alert.sh
else
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "No update available"
echo -e "* Local build: ${green}${localbuild} ${factorioarch}${default}"
echo -e "* Remote build: ${green}${remotebuild} ${factorioarch}${default}"
Expand Down
2 changes: 2 additions & 0 deletions lgsm/functions/update_minecraft.sh
Expand Up @@ -135,6 +135,7 @@ fn_update_minecraft_compare(){
fn_print_dots "Checking for update: ${remotelocation}"
if [ "${localbuild}" != "${remotebuild}" ]||[ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "Update available"
echo -e "* Local build: ${red}${localbuild}${default}"
echo -e "* Remote build: ${green}${remotebuild}${default}"
Expand Down Expand Up @@ -179,6 +180,7 @@ fn_update_minecraft_compare(){
alert.sh
else
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "No update available"
echo -e "* Local build: ${green}${localbuild}${default}"
echo -e "* Remote build: ${green}${remotebuild}${default}"
Expand Down
2 changes: 2 additions & 0 deletions lgsm/functions/update_minecraft_bedrock.sh
Expand Up @@ -104,6 +104,7 @@ fn_update_minecraft_compare(){
remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]')
if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "Update available"
echo -e "* Local build: ${red}${localbuild}${default}"
echo -e "* Remote build: ${green}${remotebuild}${default}"
Expand Down Expand Up @@ -145,6 +146,7 @@ fn_update_minecraft_compare(){
alert.sh
else
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "No update available"
echo -e "* Local build: ${green}${localbuild}${default}"
echo -e "* Remote build: ${green}${remotebuild}${default}"
Expand Down
1 change: 1 addition & 0 deletions lgsm/functions/update_mta.sh
Expand Up @@ -179,6 +179,7 @@ fn_update_mta_compare(){
alert.sh
else
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "No update available"
echo -e "* Local build: ${green}${localbuild}${default}"
echo -e "* Remote build: ${green}${remotebuild}${default}"
Expand Down
2 changes: 2 additions & 0 deletions lgsm/functions/update_mumble.sh
Expand Up @@ -72,6 +72,7 @@ fn_update_mumble_compare(){
remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]')
if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "Update available"
echo -e "* Local build: ${red}${localbuild} ${mumblearch}${default}"
echo -e "* Remote build: ${green}${remotebuild} ${mumblearch}${default}"
Expand Down Expand Up @@ -113,6 +114,7 @@ fn_update_mumble_compare(){
alert.sh
else
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "No update available"
echo -e "* Local build: ${green}${localbuild} ${mumblearch}${default}"
echo -e "* Remote build: ${green}${remotebuild} ${mumblearch}${default}"
Expand Down

0 comments on commit 1cc5d3a

Please sign in to comment.