macOS tools moving to my git

This commit is contained in:
2026-05-10 12:53:30 -07:00
parent 61c0d4b5f1
commit 83156ea9e8
101 changed files with 3011 additions and 0 deletions

35
maintwakes-halt Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
OUTPUT='/tmp/statusmail.txt'
OUTPUT2='/tmp/maintwakes.txt'
TIMEINT='1h'
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} ]
if [ "$lines" -gt 1 ]
then
echo "Occurances: $lines" >> ${OUTPUT}
echo "Duration: ${DURATION}" >> ${OUTPUT}
echo "Time Interval: ${TIMEINT}" >> ${OUTPUT}
echo "------------------------------------------------------------------" >> ${OUTPUT}
echo "" >> ${OUTPUT}
echo "" >> ${OUTPUT}
cat ${OUTPUT2} >> ${OUTPUT}
echo "" >> ${OUTPUT}
echo "" >> ${OUTPUT}
echo "------------------------------------------------------------------" >> ${OUTPUT}
#echo "$ott" > /tmp/wakemaints.txt
/usr/bin/python3 $HOME/Dropbox/bin/send_status_mail3.py
else
echo "No maintenance wakes last ${TIMEINT}"
fi
#cat /tmp/wakemaints.txt | fgrep "Wake reason"
rm ${OUTPUT}
rm ${OUTPUT2}
if [ "$lines" -gt 10 ]
then
sleep 10
osascript -e 'tell application "System Events" to shut down'
fi