Script monitoring status zimbra

sudo mkdir /etc/scripts
sudo vi /etc/scripts/checkZimbra.sh

!/bin/bash
Script monitoring status zimbra
USERID="1223456789"
KEY="123456789:AAH9UZevcFx2S__oiQeX_o7A8T4b8jmVJSI"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
clear
SRV="mail.agink.id";
yes | rm /tmp/status-$SRV.txt
su - zimbra -c 'zmcontrol status' > /tmp/status-$SRV.txt
NOTRUNNING=grep -woi "not running" /tmp/status-$SRV.txt | uniq;
STOPPED=grep -woi "stopped" /tmp/status-$SRV.txt | uniq;
if [ "$NOTRUNNING" == "not running" -o "$STOPPED" == "Stopped" ] ; then
SERVER="$SRV";
STATUS=cat /tmp/status-$SRV.txt;
TEXT="[MAIL - 192.168.0.25]%0AStatus Service Zimbra%0A DateTime: $DATE_EXEC%0A Host : $SERVER%0A Status : %0A $STATUS%0A Action : Restart Zimbra%0A%0A%0A---%0AAuthor by Aditya Maulana"
curl -s --max-time $TIMEOUT -d "chat_id=$USERID&disable_web_page_preview=1&parse_mode=Markdown&text=$TEXT" $URL > /dev/null
su - zimbra -c 'zmcontrol restart'
fi

sudo chmod +x /etc/scripts/checkZimbra.sh

add to cronjobs

sudo crontab -e
*/10 * * * * /etc/scripts/checkZimbra.sh > /dev/null 2>&1