Created
May 2, 2012 14:21
-
-
Save cpu/2576855 to your computer and use it in GitHub Desktop.
Simple Upstart Script to send a PushOver notification when the machine boots.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment