feature: webhook notify on systemd service start/stop
This commit is contained in:
parent
e12477369d
commit
43ba83cf72
3 changed files with 13 additions and 0 deletions
|
@ -22,6 +22,10 @@ Copy `.env.example` to `.env`:
|
|||
- Settings > Advanced > Developer Mode: enabled
|
||||
- Right click the guild and select "Copy ID"
|
||||
|
||||
- `DISCORD_STATUS_WEBHOOK_URL` (optional) is used to monitor when the bot fails
|
||||
- Channel Settings > Integrations > New Webhook (don't forget to save changes)
|
||||
- Copy Webhook URL
|
||||
|
||||
- `DISCORD_BOT_ADMIN_ROLE_ID` for reloading cogs
|
||||
- `DISCORD_BOT_ADMIN_USER_ID` for reloading cogs
|
||||
- `DISCORD_VCJOIN_CHANNEL` for the VCJoin cog
|
||||
|
|
7
contrib/notify.sh
Normal file
7
contrib/notify.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
curl \
|
||||
-X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"username": "system", "content": "'"$1"'"}' \
|
||||
$DISCORD_STATUS_WEBHOOK_URL
|
|
@ -8,6 +8,8 @@ User=discord
|
|||
WorkingDirectory=/srv/discord/%I
|
||||
EnvironmentFile=/srv/discord/%I/.env
|
||||
ExecStart=/srv/discord/.venv/bin/python -u app.py
|
||||
ExecStopPost=/srv/discord/%I/notify.sh "umi instance stopped: `%i`"
|
||||
ExecStartPost=/srv/discord/%I/notify.sh "umi instance started: `%i`"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Add table
Reference in a new issue