Skip to content

Instantly share code, notes, and snippets.

@idflorin
Last active January 18, 2024 02:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save idflorin/2b11f7f1d2d2ac3d856f63697997d534 to your computer and use it in GitHub Desktop.
Save idflorin/2b11f7f1d2d2ac3d856f63697997d534 to your computer and use it in GitHub Desktop.
Cron job for aapanel check systemctl status dovecot rspamd postfix telegram
#!/bin/bash
SERVICE="dovecot"
if (systemctl is-active -q $SERVICE)
then
echo "$SERVICE is running"
# curl -s "https://api.telegram.org/bot5233333629:AXDDDDDDDxqVTr_SWhh8SGo/sendMessage?chat_id=17522222222208&text='$SERVICE is running'"
else
# echo "$SERVICE stopped"
curl -s "https://api.telegram.org/bot5233333629:AXDDDDDDDxqVTr_SWhh8SGo/sendMessage?chat_id=17522222222208&text='$SERVICE 193.187.129.202:31202/b066ea5s6m202 stopped!!!'"
# uncomment to start rspamd if stopped
systemctl start dovecot
# mail
fi
#!/bin/bash
SERVICE="rspamd"
if (systemctl is-active -q $SERVICE)
then
echo "$SERVICE is running"
# curl -s "https://api.telegram.org/bot5233333629:AXDDDDDDDxqVTr_SWhh8SGo/sendMessage?chat_id=17522222222208&text='$SERVICE is running'"
else
# echo "$SERVICE stopped"
curl -s "https://api.telegram.org/bot5233333629:AXDDDDDDDxqVTr_SWhh8SGo/sendMessage?chat_id=17522222222208&text='$SERVICE 193.187.129.202:31202/b066ea5s6m202 stopped!!!'"
# uncomment to start rspamd if stopped
systemctl start rspamd
# mail
fi
#!/bin/bash
SERVICE="postfix"
if (systemctl is-active -q $SERVICE)
then
echo "$SERVICE is running"
# curl -s "https://api.telegram.org/bot5233333629:AXDDDDDDDxqVTr_SWhh8SGo/sendMessage?chat_id=17522222222208&text='$SERVICE is running'"
else
echo "$SERVICE stopped"
curl -s "https://api.telegram.org/bot5233333629:AXDDDDDDDxqVTr_SWhh8SGo/sendMessage?chat_id=17522222222208&text='$SERVICE 193.187.129.202:31202/b066ea5s6m202 stopped!!!'"
# uncomment to start dovecot if stopped
systemctl start postfix
# mail
fi
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment