fix bug caused by stopping bot while not running

This commit is contained in:
celso 2023-03-21 18:44:50 -03:00
parent b99ae05874
commit 6a3ae1bbf0
1 changed files with 4 additions and 1 deletions

5
bot.sh
View File

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
[ "${1}" == "stop" ] && kill -SIGTERM "$(cat /tmp/tpdnsbot.pid)" 2>/dev/null && exit 0 [ "${1}" == "stop" ] && {
kill -SIGTERM "$(cat /tmp/tpdnsbot.pid)" 2>/dev/null
exit 0
}
printf "%s" "${$}" > /tmp/tpdnsbot.pid printf "%s" "${$}" > /tmp/tpdnsbot.pid
api_url="https://api.telegram.org/bot${TELEGRAM_DNS_TOKEN}/" api_url="https://api.telegram.org/bot${TELEGRAM_DNS_TOKEN}/"