fr3nch13 / pushover-bash
Pushover Bash 脚本
This package is auto-updated.
Last update: 2024-09-25 00:26:19 UTC
README
Pushover Bash 脚本
一个用于发送 Pushover 通知的 Bash 脚本。使用此脚本需要 Pushover 账户。
基于 akusei 的原始 Pushover Bash。
用法
usage: pushover.sh <apikey> <userkey> <message> [options]
-t, --token APIKEY The pushover.net API Key for your application
-u, --user USERKEY Your pushover.net user key
-m, --message MESSAGE The message to send; supports HTML formatting
-a, --attachment filename The Picture you want to send
-T, --title TITLE Title of the message
-d, --device NAME Comma seperated list of devices to receive message
-U, --url URL URL to send with message
--url-title URLTITLE Title of the URL
-p, --priority PRIORITY Priority of the message
-2 - no notification/alert
-1 - quiet notification
0 - normal priority
1 - bypass the user's quiet hours
2 - require confirmation from the user
-e, --expire SECONDS Set expiration time for for notifications with priority 2 (default 180)
-r, --retry COUNT Set retry period for notifications with priority 2 (default 30)
-s, --sound SOUND Notification sound to play with message
pushover - Pushover (default)
bike - Bike
bugle - Bugle
cashregister - Cash Register
classical - Classical
cosmic - Cosmic
falling - Falling
gamelan - Gamelan
incoming - Incoming
intermission - Intermission
magic - Magic
mechanical - Mechanical
pianobar - Piano Bar
siren - Siren
spacealarm - Space Alarm
tugboat - Tug Boat
alien - Alien Alarm (long)
climb - Climb (long)
persistent - Persistent (long)
echo - Pushover Echo (long)
updown - Up Down (long)
none - None (silent)
-x, --validate If set, it will only validate the account
-v, --verbose Return API execution reply to stdout
-d, --debug Print out debugging information
WARNING, this will output your user key and token to stdout
配置
配置文件可以放置在 /etc/pushover/pushover-config,在用户的家目录中 $HOME/.pushover/pushover-config,或者在仓库的根目录。根据位置的重要性依次处理选项。您可以将 pushover-config-dist 复制到任一位置的 pushover-config。
- 首先处理 /etc/pushover/pushover-config 中的选项
- 然后处理 $HOME/.pushover/pushover-config 中的选项
- 然后处理 ./pushover-config 中的选项
- 命令行参数覆盖所有配置值
默认配置为空,包含以下内容
api_token=
user_key=
device=
url=
url_title=
priority=
title=
sound=
注意: 如果在 /etc/default/ 中定义了值,并且 $HOME/.pushover/ 中有覆盖项,则 $HOME/.pushover/ 中的所有空选项都必须不存在于文件中。例如,我在 /etc/default/ 中有以下配置
api_token=my-app-api-token user_key=my-user-key device= url= url_title="I want all URLs to have this title" priority= title="this is a generic title" sound=
如果我想仅覆盖特定用户的 标题,则 $HOME/.pushover/ 中的配置将如下所示
title="title for specific user"
支持
- 对于基于 PHP Composer 的项目,请参阅 COMPOSER.md
- 对于基于 Node.js/NPM 的项目,请参阅 NPM.md
- 目前正在处理 Python 的 PyPi
示例
使用存储在 /etc/default/pushover-config、$HOME/.pushover/pushover-config 或 ./pushover-config 中的配置,向所有设备发送简单的 "This is a test" 消息
pushover.sh -m "This is a test"
使用指定的 API 令牌和用户密钥向所有设备发送简单的 "This is a test" 消息
pushover.sh -t token -u key -m "This is a test"
使用指定的 API 令牌和用户密钥向所有设备发送标题为 "Test Title" 的简单 "This is a test" 消息
pushover.sh -t token -u key -m "This is a test" -T "Test Title"
使用指定的 API 令牌和用户密钥向名为 "Phone" 和 "Home Desktop" 的设备发送简单的 "This is a test" 消息
pushover.sh -t token -u key -m "This is a test" -d "Phone,Home Desktop"
使用指定的 API 令牌和用户密钥向包含标题为 "Google" 且链接到 www.google.com 的消息发送简单的 "This is a test" 消息
pushover.sh -t token -u key -m "This is a test" -U "http://www.google.com" --url-title Google
使用指定的 API 令牌和用户密钥向所有设备发送高优先级的简单 "This is a test" 消息
pushover.sh -t token -u key -m "This is a test" -p 1
使用指定的 API 令牌和用户密钥向所有设备发送使用自行车铃声作为通知声音的简单 "This is a test" 消息
pushover.sh -t token -u key -m "This is a test" -s bike
向所有设备发送简单的 "This is a test Pic" 消息,并将图片与消息一起发送
pushover.sh -t token -u key -m "This is a test Pic" -a /path/to/pic.jpg