Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-12-2011, 08:13 PM
Special Member
 
Posts: 123
Question Unable to use zmcontrol via CronTAB

Hi,

I'm running into a really strange problem and I'm out of ideas. The good thing is I've been able to reproduce this problem both in my production and VM environments.

I'm trying to use a bash script to stop, and start zimbra via the crontab.
But what happens is, when zimbra starts, some of the services fail to load. I have to manually retry zmcontrol stop/start several times to everything to load fine again.

IF I run the same script manually, everything works just fine. Any help would be appreciated.

Here is my simple script being run as the zimbra user:

/opt/zimbra/bin/zmcontrol stop > /opt/scripts/zmcontrol_stop.out
#Wait 45 sec for all services to properly shut down
sleep 45
/opt/zimbra/bin/zmcontrol start > /opt/scripts/zmcontrol_start.out

Output of zmcontrol_stop.out
Code:
[zimbra@gp-sf1-xen01-centos scripts]$ tail -f zmcontrol_stop.out
        Stopping snmp...Done.
        Stopping cbpolicyd...Done.
        Stopping archiving...Done.
        Stopping antivirus...Done.
        Stopping antispam...Done.
        Stopping imapproxy...Done.
        Stopping memcached...Done.
        Stopping mailbox...Done.
        Stopping logger...Done.
        Stopping ldap...Done.

Output of zmcontrol_start.out
Code:
[zimbra@gp-sf1-xen01-centos scripts]$ tail -f zmcontrol_start.out
Host mail.leotest.com
        Starting ldap...Done.
        Starting zmconfigd...Done.
        Starting logger...Failed.
Starting logswatch...failed.


        Starting mailbox...Done.
        Starting antispam...Done.
        Starting antivirus...Done.
        Starting snmp...Done.
        Starting spell...Done.
        Starting mta...Done.
        Starting stats...Done.
Again, if I run this script manually as the zimbra user, everything works perfectly fine.


Both VM and production environments are running zimbra 7.1.3 under CentOS in a XEN virtual environment
Reply With Quote
  #2 (permalink)  
Old 11-18-2011, 08:21 AM
Junior Member
 
Posts: 8
Default

I'm not sure if this is the problem here, but often when a command runs fine on the command line but fails in cron, it's because cron doesn't have the same environment. Your .profile, .bash_profile, and .bashrc do not get evaluated by the cron shell. You might try making a shell script that either reads those files or duplicates the setting of relevant environment variables and then calls the zmcontrol commands. I see the .bashrc on my system sets a bunch of variables, like ZIMBRA_HOME, JAVA_HOME, PERLLIB, JYTHONPATH, etc.
Reply With Quote
  #3 (permalink)  
Old 11-18-2011, 04:06 PM
Advanced Member
 
Posts: 206
Default

Try sudoers and complete routes to zimbra commands.

Regards.

Last edited by ccelis5215; 11-18-2011 at 04:07 PM.. Reason: spelling
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.