Przeglądaj źródła

Added fixes to email notification

Further improvements to come.
Daniel Gibbs 10 lat temu
rodzic
commit
6f7bd74c8b
1 zmienionych plików z 10 dodań i 10 usunięć
  1. 10 10
      functions/email.sh

+ 10 - 10
functions/email.sh

@@ -2,41 +2,41 @@
 # LGSM email.sh function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="010216"
 
 # Description: Sends email notification if monitor picks up a failure.
 
 local modulename="Email"
 fn_printdots "Sending notification to ${email}"
-echo -en "\n"
 info_distro.sh
 {
-	echo -e "========================================\n${servicename} details\n========================================\n"
+	echo -e "========================================\n${servicename} details\n========================================"
 	echo -e "Service: ${servicename}"
 	echo -e "Server: ${servername}"
 	echo -e "Game: ${gamename}"
 	echo -e "Failure reason: ${failurereason}"
 	echo -e "Action Taken: ${actiontaken}\n"
-	echo -e "========================================\nServer details\n========================================\n"
+	echo -e "========================================\nServer details\n========================================"
 	echo -e "Date: $(date)"
 	echo -e "Distro: ${os}"
 	echo -e "Arch: ${arch}"
 	echo -e "Kernel: ${kernel}"
 	echo -e "Hostname: $HOSTNAME"
+	echo -e "tmux: ${tmuxv}"
+	echo -e "GLIBC: ${glibcv}"	
 	echo -e "Uptime: ${days}d, ${hours}h, ${minutes}m"
 	echo -e "Avg Load${load}\n"
-	echo -e "========================================\nLogs\n========================================\n"
-	echo -e "Script log\n===================\n"
-	command_details.sh
-}|sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"|tee "${scriptlogdir}/${servicename}-email.log"
+	echo -e "========================================\nLogs\n========================================"
+}| sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee "${scriptlogdir}/${servicename}-email.log" > /dev/null 2>&1
+echo -e "Script log\n===================\n" >> "${emaillog}"
 tail -25 "${scriptlog}" >> "${emaillog}"
 if [ ! -z "${consolelog}" ]; then
 	echo -e "\n\nConsole log\n====================\n" >> "${emaillog}"
-	tail -25 "${consolelog}" >> "${emaillog}"
+	tail -25 "${consolelog}" | awk '{ sub("\r$", ""); print }' >> "${emaillog}"
 fi
 if [ ! -z "${gamelogdir}" ]; then
 	echo -e "\n\nServer log\n====================\n" >> "${emaillog}"
-	tail "${gamelogdir}"/*|grep -v "==>"|sed '/^$/d'|tail -25 >> "${emaillog}"
+	tail "${gamelogdir}"/* | grep -v "==>" | sed '/^$/d' | tail -25 >> "${emaillog}"
 fi
 mail -s "${subject}" ${email} < "${emaillog}"
 fn_printok "Sending notification to ${email}"