Skip to content

Commit 41522f9

Browse files
committed
pushover - switch from env vars to .conf
1 parent b88662f commit 41522f9

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

pushover

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
#
66
# uses pushover.sh from https://raw.githubusercontent.com/jnwatts/pushover.sh/master/pushover.sh
77
#
8-
# You need to either export PUSHOVER_API_KEY and PUSHOVER_USER_KEY, or set them in
9-
# ~/.pushover_keys.sh
10-
#
118
###################################################################################
129
#
1310
# Copyright 2015 Jason Antman <[email protected]> <http://www.jasonantman.com>
@@ -28,10 +25,13 @@
2825
#
2926
###################################################################################
3027
#
31-
# Version 1.0.0
28+
# Version 1.0.1
3229
#
3330
# CHANGELOG:
3431
#
32+
# * 1.0.1 2015-05-11 Jason Antman <[email protected]>
33+
# * swith from env vars for pushover keys to ~/.config/pushover.conf
34+
#
3535
# * 1.0.0 2015-05-11 Jason Antman <[email protected]>
3636
# * Initial public version
3737
#
@@ -43,18 +43,6 @@ if ! which pushover.sh > /dev/null 2>&1; then
4343
exit 1
4444
fi
4545

46-
[[ -f ~/.pushover_keys.sh ]] && source ~/.pushover_keys.sh
47-
48-
if [ -z "$PUSHOVER_API_KEY" ]; then
49-
>&2 echo "ERROR: export PUSHOVER_API_KEY or set in ~/.pushover_keys.sh"
50-
exit 2
51-
fi
52-
53-
if [ -z "$PUSHOVER_USER_KEY" ]; then
54-
>&2 echo "ERROR: export PUSHOVER_USER_KEY or set in ~/.pushover_keys.sh"
55-
exit 3
56-
fi
57-
5846
stime=$(date '+%s')
5947
$@
6048
exitcode=$?
@@ -68,13 +56,13 @@ times=$(printf '%d:%02d:%02d' $dh $dm $ds)
6856
# end timer
6957
if [ "$exitcode" -eq 0 ]
7058
then
71-
pushover.sh -p 0 -t "Command Succeeded" -T "$APIKEY" -U "$USERKEY" "succeeded in ${times} on $(hostname): $@ (in $(pwd))"
59+
pushover.sh -p 0 -t "Command Succeeded" "succeeded in ${times} on $(hostname): $@ (in $(pwd))"
7260
echo "(sent pushover success notification)"
7361
if which notify-send 2>&1 > /dev/null; then
7462
notify-send "Command Succeeded" "succeeded in ${times}: $@ (in $(pwd))"
7563
fi
7664
else
77-
pushover.sh -p 0 -s falling -t "Command Failed" -T "$APIKEY" -U "$USERKEY" "failed in ${times} (exit $exitcode) on $(hostname): $@ (in $(pwd))"
65+
pushover.sh -p 0 -s falling -t "Command Failed" "failed in ${times} (exit $exitcode) on $(hostname): $@ (in $(pwd))"
7866
echo "(sent pushover failure notification)"
7967
if which notify-send 2>&1 > /dev/null; then
8068
notify-send "Command Failed" "failed in ${times} (exit $exitcode): $@ (in $(pwd))"

0 commit comments

Comments
 (0)