Automatically restart the service

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

Automatically restart the service

Postby dimon » Fri Nov 15, 2019 9:39 am

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: 26345
Joined: Fri Sep 12, 2014 9:56 pm
Location: Liverpool, England

Re: Automatically restart the service

Postby phoenix » Fri Nov 15, 2019 1:14 pm

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

If you'd like to see this implemented in a future version of ZCS then please vote on Bugzilla entries 97706 & 108168
dimon
Posts: 8
Joined: Wed Feb 14, 2018 5:01 am

Re: Automatically restart the service

Postby dimon » Mon Nov 18, 2019 3:23 am

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: 8
Joined: Wed Feb 14, 2018 5:01 am

Re: Automatically restart the service

Postby dimon » Tue Nov 19, 2019 7:18 pm

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

Return to “Administrators”

Who is online

Users browsing this forum: No registered users and 11 guests