macOS tools moving to my git
This commit is contained in:
23
shutdown_safe
Executable file
23
shutdown_safe
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
OUTPUT='/tmp/statusmail.txt'
|
||||
TIMEINT='2h'
|
||||
START="$(date +%s)"
|
||||
echo "" > ${OUTPUT}
|
||||
log show --style syslog --last ${TIMEINT} | fgrep "Wake reason" | fgrep "Maintenance" >> ${OUTPUT2}
|
||||
lines=`cat ${OUTPUT2} | grep -c '^'`
|
||||
DURATION=$[ $(date +%s) - ${START} ]
|
||||
echo "----| Shut Down Report |----" >> ${OUTPUT}
|
||||
echo "" >> ${OUTPUT}
|
||||
echo "Occurances: $lines" >> ${OUTPUT}
|
||||
echo "Duration: ${DURATION}" >> ${OUTPUT}
|
||||
echo "Time Interval: ${TIMEINT}" >> ${OUTPUT}
|
||||
echo "------------------------------------------------------------------" >> ${OUTPUT}
|
||||
echo "" >> ${OUTPUT}
|
||||
echo "" >> ${OUTPUT}
|
||||
echo "" >> ${OUTPUT}
|
||||
echo "" >> ${OUTPUT}
|
||||
echo "------------------------------------------------------------------" >> ${OUTPUT}
|
||||
/usr/bin/python3 /Users/shughey/Dropbox/bin/send_status_mail3.py
|
||||
rm ${OUTPUT}
|
||||
osascript -e 'tell app "System Events" to shut down'
|
||||
Reference in New Issue
Block a user