From 82885d54288593b5714ee8c719d1f3f075d40386 Mon Sep 17 00:00:00 2001 From: F3RR3T Date: Wed, 10 Sep 2014 09:53:23 +1000 Subject: Now use environment var to mask email address --- reboot.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 reboot.sh (limited to 'reboot.sh') diff --git a/reboot.sh b/reboot.sh new file mode 100755 index 0000000..19c9391 --- /dev/null +++ b/reboot.sh @@ -0,0 +1,36 @@ +#!/bin/bash - +# SJP 9 Sept 2014 +# Run by cron after reboot. +# Sends an email to st33v. + +# https://www.linuxquestions.org/questions/linux-server-73/delay-startup-script-until-15-minutes-after-boot-661245/ +# at now + 15 minutes -f your_script +# Alternately, use a script, whose first line is +# sleep 900 +# and start it from rc.local like this +# nohup /path/myscript & +# which will disconnect it from the startup and background it. + +cd ~/mail/monitor +touch data/heartlock # make a file to stop heartbeat overwriting + +cat <<- EOF > data/emailbody.txt + Cumquat has rebooted + ==================== + + $(cat data/heartbeat.txt) + + ----------------------------------------------------------- + Current status at $(date): + $(procinfo -Hr) + + ----------------------------------------------------------- + Was there a shutdown command? + $(cat /var/log/auth.log | grep shutdown) + +EOF + +sleep 180 # wait 3 mins to make sure have network +cat data/emailbody.txt | mail -A cumquat -s "Cumquat reboot notification" $EMAILST33V +rm data/emailbody.txt +rm data/heartlock -- cgit v1.3