Automatically restart the service

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
dimon
Posts: 12
Joined: Wed Feb 14, 2018 5:01 am

Automatically restart the service

Post by dimon »

hi, tell me, is it possible to configure the zmailboxdctl service so that when it falls, it restarts itself? The service crashes once a day.

Best regards, Dimon.
phoenix
Ambassador
Ambassador
Posts: 27278
Joined: Fri Sep 12, 2014 9:56 pm
Location: Liverpool, England

Re: Automatically restart the service

Post by phoenix »

You should start by finding out why the service is failing and fix that problem, my server is up for months-on-end and I see no such problem with any ZCS services. Just restarting the service continually is not the answer to your problem but If you really want to go down the restart 'route' then you can use something like monit.
Regards

Bill

Rspamd: A high performance spamassassin replacement

Per ardua ad astra
dimon
Posts: 12
Joined: Wed Feb 14, 2018 5:01 am

Re: Automatically restart the service

Post by dimon »

phoenix wrote:You should start by finding out why the service is failing and fix that problem, my server is up for months-on-end and I see no such problem with any ZCS services. Just restarting the service continually is not the answer to your problem but If you really want to go down the restart 'route' then you can use something like monit.

This is clear to me, what data should I provide to help me, because I don’t know how to fix it?


Best regards, Dimon
dimon
Posts: 12
Joined: Wed Feb 14, 2018 5:01 am

Re: Automatically restart the service

Post by dimon »

Who cares, here are your "crutches":

Two files

check_proc.sh

Code: Select all

#!/bin/bash
ps_out=`/opt/zimbra/bin/zmcontrol status | grep $1 | grep -v 'grep' | grep -v $0`
result=$(echo $ps_out | grep "$1" | grep "$2")
if [[ "$result" != "" ]];then
        echo "true"
else
        echo "false"
fi


scr.sh

Code: Select all

#!/bin/bash
if [[ "$(/bin/sh /opt/store/check_proc.sh mailbox Running)" == "false" ]];then
        /opt/zimbra/bin/zmmailboxdctl restart > /dev/null &
fi
crontab -e

*/3 * * * * /bin/bash /opt/store/scr.sh > /tmp/backup.log 2>&1

It's works
Post Reply