theocorp_docker_compose/send_notification.sh
2025-05-10 11:36:33 -04:00

57 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Default values
TOKEN="a1gkitc5obmf5ak4xxgw1ewnuthn36"
USER="u2a62kgzz844gxzw1cvkczhyvei62j"
MESSAGE=""
# Help message
show_help() {
echo "Usage: $0 [options]"
echo "Options:"
echo " -t, --token Pushover API token (default: $TOKEN)"
echo " -u, --user Pushover user key (default: $USER)"
echo " -m, --message Message to send (required)"
echo " -h, --help Show this help message"
exit 1
}
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-t|--token)
TOKEN="$2"
shift 2
;;
-u|--user)
USER="$2"
shift 2
;;
-m|--message)
MESSAGE="$2"
shift 2
;;
-h|--help)
show_help
;;
*)
echo "Unknown option: $1"
show_help
;;
esac
done
# Check if message is provided
if [ -z "$MESSAGE" ]; then
echo "Error: Message is required"
show_help
fi
# Send the notification
curl -s \
--form-string "token=$TOKEN" \
--form-string "user=$USER" \
--form-string "message=$MESSAGE" \
https://api.pushover.net/1/messages.json
echo