Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdestafadilah/b862c95f12790b31b2cedc6ee184ab9c to your computer and use it in GitHub Desktop.
Save mdestafadilah/b862c95f12790b31b2cedc6ee184ab9c 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 $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 $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 $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