Skip to content

Instantly share code, notes, and snippets.

@cpu
Created May 2, 2012 03:13
Show Gist options
  • Save cpu/2573326 to your computer and use it in GitHub Desktop.
Save cpu/2573326 to your computer and use it in GitHub Desktop.
Simple Upstart Script to send a PushOver notification when the machine boots.
#
# pushoverbooted service
#
# Sends a PushOver notification when the box has finished booting. To
# install, place this file in /etc/init/ You can test the service by
# running 'start pushoverbooted'
#
# You will need to replace TOKEN with the value you get upon following the
# registration process for a pushover application detailed at:
# https://pushover.net/api#registration
#
# You will also have to provide the USER_KEY for the account you wish
# to push to. This can be found in the PushOver app settings page on
# your device.
#
description "Pushover Machine Booted Task"
author "Daniel McCarney <[email protected]>"
env TOKEN=REPLACE_ME_WITH_YOUR_APP_TOKEN
env USER_KEY=REPLACE_ME_WITH_YOUR_USER_KEY
#Exec when the machine gets to the graphical/network runlevel
start on runlevel [2]
#Fire off once and then terminate. Not a true 'service'
task
# Send the push notification
script
# I like to capitalize the first letter of my hostnames for the push msg
HOST=$(hostname | sed -r 's/^(.)/\U\1/g')
/usr/bin/curl -s \
-F "token=$TOKEN" \
-F "user=$USER_KEY" \
-F "message=$HOST has finished booting." \
https://api.pushover.net/1/messages
end script
@cpu
Copy link
Author

cpu commented May 2, 2012

Maybe this will help you with the power saving script in the lab @davidbb

I'm debating writing one for shutdown as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment