Last active
November 15, 2020 23:44
-
-
Save henri/2acac90edb7a010c9b648bb1c4541b58 to your computer and use it in GitHub Desktop.
PushOver
This file contains hidden or 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
#! /bin/bash | |
# | |
# RELEASED UNDER MIT LICENCE : https://mit-license.org | |
# Copyright Allrights Reserved 2020, Henri Shustak | |
# This Script Works With the PushOver <http://pushover.net> service and is capable of sending notifcations to your phone. | |
# | |
# Usage: ./pushover.bash message title url url_title priority device' | |
# | |
# Example: ./pushover.sh "this is a test" "test title" "http://mylink.com" "my url title" 0 "iPhone"' | |
# Note: All parameters except message are optional' | |
# | |
# | |
# Descriptin : This PushOver script will allow devies to send messages out via PushOver API. | |
# Just copy the script, make it executable chmod -x and then finally, run it with some perameters. | |
# | |
# configuration | |
app="APPNAME" # you can set this to something else that makes sense if you like | |
userkey=YOUR_TOKEN_HERE # Look at https://pushover.net/ to find your user key | |
apikey=YOUR_TOKEN_HERE # Replace YOURAPIKEY with your key | |
message=${1} | |
title=${2} | |
url=${3} | |
url_title=${4} | |
priority=${5} | |
device=${6} | |
if [ $# -lt 1 ]; then | |
echo 'pushover.sh' | |
echo 'Usage: ./pushover.sh message title url url_title priority device' | |
echo 'Example: ./pushover.sh "this is a test" "test title" "http://myurl.com" "URL Title" 0 "iPad"' | |
echo ' note : all parameters except message are optional' | |
else | |
curl https://api.pushover.net/1/messages.json -F token=$apikey -F user=$userkey -F message="$message" -F title="$title" -F url="$url" -F url_title="$url_title" -F priority="$priority" -F device="$device" | |
fi | |
echo "" |
This file contains hidden or 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
#!/bin/bash | |
# example script which can send a notification on login. You could add this to /etc/profile.d/ on a GNU/LINUX system | |
# There are much better places to put hooks so you see all kinds of logins. This is an example. | |
# send pushover notification | |
/usr/local/bin/pushover.sh "login-detected" "my super duper secure system" > /dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment