If your Mac reboots, and you want to be notified that it has rebooted.
Create a .plist
file at /Library/LaunchDaemons/com.YOUR_COMPANY.rebootnotification.plist
. Change YOUR_COMPANY
to your domain name in the .plist
file. The contents will look like the following, change /path/to/your/script.sh
to your script. This .plist
file and the /path/to/your/script.sh
should be owned by root:wheel
my advise is to make it only executable by root. I take no responsiblities for any Security issues.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.rebootnotification</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/your/script.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
curl -H "Content-type: application/json" \
--data '{"channel":"C123456","blocks":[{"type":"section","text":{"type":"mrkdwn","text":"Your message here."}}]}' \
-H "Authorization: Bearer YOUR_SLACK_API_TOKEN" \
-X POST https://slack.com/api/chat.postMessage
curl -X POST -H 'Content-type: application/json' --data '{"text": "Your message here."}' https://hooks.slack.com/services/YOUR/WEBHOOK/URL