26 lines
556 B
Bash
Executable File
26 lines
556 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ $# -eq 0 ]; then
|
|
exit
|
|
fi
|
|
|
|
MESSAGE=$1
|
|
TITLE=$2
|
|
|
|
if [ $# -lt 2 ]; then
|
|
TITLE=$HOSTNAME
|
|
fi
|
|
|
|
|
|
# wget https://api.pushover.net/1/messages.json --post-data="token=$APP_TOKEN&user=$USER_TOKEN&message=$MESSAGE&title=$TITLE" -qO- > /dev/null 2>&1 &
|
|
cmd="curl -s \
|
|
--form-string 'token=$PUSHOVER_APP_TOKEN' \
|
|
--form-string 'user=$PUSHOVER_USER_TOKEN' \
|
|
--form-string 'message=$MESSAGE' \
|
|
--form-string 'title=$TITLE' "
|
|
if [ $# -ge 3 ]; then
|
|
cmd="$cmd -F 'attachment=@$3'"
|
|
fi
|
|
cmd="$cmd https://api.pushover.net/1/messages.json"
|
|
eval $cmd
|