Minimal functionality implemented

Minimal functionality implemented
This commit is contained in:
2022-06-27 00:16:39 +03:00
parent 239197ffed
commit e0011e421d
10 changed files with 1357 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
[Unit]
Description=Watchdog service
[Service]
User=wwwrun
Group=www
Type=simple
ExecStart=/usr/local/bin/cai-watchdog
KillMode=control-group
NotifyAccess=all
SuccessExitStatus=2
[Install]
WantedBy=multi-user.target
Alias=cai_watchdog

View File

@@ -0,0 +1,23 @@
#!/bin/bash
GROUP_ID=<group_id>
BOT_TOKEN=<bot_token>
# this 3 checks (if) are not necessary but should be convenient
if [ "$1" == "-h" ]; then
echo "Usage: `basename $0` \"text message\""
exit 0
fi
if [ -z "$1" ]
then
echo "Add message text as second arguments"
exit 0
fi
if [ "$#" -ne 1 ]; then
echo "You can pass only one argument. For string with spaces put it on quotes"
exit 0
fi
curl -s --data "text=$1" --data "chat_id=$GROUP_ID" 'https://api.telegram.org/bot'$BOT_TOKEN'/sendMessage' > /dev/null