Skip to content
Permalink
Browse files

fix(messages): fix some messages not using newline correctly (#2772)

* update donate links
  • Loading branch information
dgibbs64 committed Mar 21, 2020
1 parent bb86a85 commit 3bd64bbc1330d34d8746db6a2b131b6fd50acbb4
@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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
@@ -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_nl "Sending Discord alert: ${discordsend}"
fn_print_fail "Sending Discord alert: ${discordsend}"
fn_script_log_fatal "Sending Discord alert: ${discordsend}"
else
fn_print_ok_nl "Sending Discord alert"
fn_print_ok "Sending Discord alert"
fn_script_log_pass "Sending Discord alert"
fi
@@ -18,9 +18,9 @@ else
fi
exitcode=$?
if [ "${exitcode}" == "0" ]; then
fn_print_ok_nl "Sending Email alert: ${email}"
fn_print_ok "Sending Email alert: ${email}"
fn_script_log_pass "Sending Email alert: ${email}"
else
fn_print_fail_nl "Sending Email alert: ${email}"
fn_print_fail "Sending Email alert: ${email}"
fn_script_log_fatal "Sending Email alert: ${email}"
fi
@@ -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_nl "Sending IFTTT alert: ${pushbulletsend}"
fn_print_fail "Sending IFTTT alert: ${pushbulletsend}"
fn_script_log_fatal "Sending IFTTT alert: ${pushbulletsend}"
else
fn_print_ok_nl "Sending IFTTT alert"
fn_print_ok "Sending IFTTT alert"
fn_script_log_pass "Sent IFTTT alert"
fi
@@ -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_nl "Sending Email alert: Mailgun: ${email}"
fn_print_fail "Sending Email alert: Mailgun: ${email}"
fn_script_log_fatal "Sending Email alert: Mailgun: ${email}"
else
fn_print_ok_nl "Sending Email alert: Mailgun: ${email}"
fn_print_ok "Sending Email alert: Mailgun: ${email}"
fn_script_log_pass "Sending Email alert: Mailgun: ${email}"
fi
@@ -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_nl "Sending Pushbullet alert: ${pushbulletsend}"
fn_print_fail "Sending Pushbullet alert: ${pushbulletsend}"
fn_script_log_fatal "Sending Pushbullet alert: ${pushbulletsend}"
else
fn_print_ok_nl "Sending Pushbullet alert"
fn_print_ok "Sending Pushbullet alert"
fn_script_log_pass "Sent Pushbullet alert"
fi
@@ -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_nl "Sending Pushover alert: ${pushoversend}"
fn_print_fail "Sending Pushover alert: ${pushoversend}"
fn_script_log_fatal "Sending Pushover alert: ${pushoversend}"
else
fn_print_ok_nl "Sending Pushover alert"
fn_print_ok "Sending Pushover alert"
fn_script_log_pass "Sent Pushover alert"
fi
@@ -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_nl "Sending Slack alert"
fn_print_ok "Sending Slack alert"
fn_script_log_pass "Sending Slack alert"
else
fn_print_fail_nl "Sending Slack alert: ${slacksend}"
fn_print_fail "Sending Slack alert: ${slacksend}"
fn_script_log_fatal "Sending Slack alert: ${slacksend}"
fi
@@ -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_nl "Sending Telegram alert: ${telegramsend}"
fn_print_fail "Sending Telegram alert: ${telegramsend}"
fn_script_log_fatal "Sending Telegram alert: ${telegramsend}"
else
fn_print_ok_nl "Sending Telegram alert"
fn_print_ok "Sending Telegram alert"
fn_script_log_pass "Sent Telegram alert"
fi
@@ -80,7 +80,7 @@ if [ "${travistest}" != "1" ]; then
core_exit.sh
fi
else
fn_print_info_nl "Check IP: ${getip}"
fn_print_info "Check IP: ${getip}"
fn_script_log_info "IP automatically set as: ${getip}"
ip="${getip}"
fi
@@ -54,7 +54,8 @@ fn_backup_init(){
else
daysago="${lastbackupdaysago} days ago"
fi
echo -e " * Previous backup was created ${daysago}, total size ${lastbackupsize}"
echo -en "\n"
echo -e "* Previous backup was created ${daysago}, total size ${lastbackupsize}"
fi
}

@@ -68,12 +69,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_nl "${selfname} will be stopped during the backup"
fn_print_warn "${selfname} will be stopped during the backup"
fn_script_log_warn "${selfname} will be stopped during the backup"
serverstopped="yes"
exitbypass=1
@@ -134,7 +135,7 @@ fn_backup_compression(){

# Check that excludedir is a valid path.
if [ ! -d "${excludedir}" ] ; then
fn_print_fail_nl "Problem identifying the previous backup directory for exclusion."
fn_print_fail "Problem identifying the previous backup directory for exclusion."
fn_script_log_fatal "Problem identifying the previous backup directory for exclusion"
core_exit.sh
fi
@@ -145,11 +146,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_nl "Starting backup"
fn_print_fail "Starting backup"
fn_script_log_fatal "Starting backup"
else
fn_print_ok_eol
fn_print_ok_nl "Completed: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
fn_print_ok "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
@@ -170,30 +171,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_nl "Pruning"
fn_print_ok "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_nl "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_print_ok "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_nl "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_print_ok "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_script_log_pass "Pruning: Cleared ${backupquotadiff} backup(s)"
fi
fi
@@ -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"

@@ -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_nl "${servername} is already running"
fn_print_info "${servername} is already running"
fn_script_log_error "${servername} is already running"
if [ -z "${exitbypass}" ]; then
core_exit.sh
@@ -211,7 +211,7 @@ fn_stop_tmux(){
fn_sleep_time
check_status.sh
if [ "${status}" == "0" ]; then
fn_print_ok_nl "${servername}"
fn_print_ok "${servername}"
fn_script_log_pass "Stopped ${servername}"
else
fn_print_fail_nl "Unable to stop ${servername}"
@@ -13,5 +13,4 @@ check.sh
info_config.sh
alert="test"
alert.sh

core_exit.sh
@@ -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_nl "Validating files: SteamCMD"
fn_print_fail "Validating files: SteamCMD"
fn_script_log_fatal "Validating files: SteamCMD: FAIL"
else
fn_print_ok_nl "Validating files: SteamCMD"
fn_print_ok "Validating files: SteamCMD"
fn_script_log_pass "Validating files: SteamCMD: OK"
fi
fix.sh
@@ -17,7 +17,7 @@ fn_fix_msg_start(){

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

@@ -72,7 +72,6 @@ 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}"
@@ -120,7 +119,6 @@ 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}"
@@ -135,7 +135,6 @@ 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}"
@@ -180,7 +179,6 @@ 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}"
@@ -104,7 +104,6 @@ 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}"
@@ -146,7 +145,6 @@ 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}"
@@ -179,7 +179,6 @@ 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}"
@@ -72,7 +72,6 @@ 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}"
@@ -114,7 +113,6 @@ 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}"

0 comments on commit 3bd64bb

Please sign in to comment.
You can’t perform that action at this time.