Results 1 to 3 of 3

Thread: Unable to use zmcontrol via CronTAB

  1. #1
    Join Date
    Sep 2007
    Rep Power

    Question Unable to use zmcontrol via CronTAB


    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
    [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
    [zimbra@gp-sf1-xen01-centos scripts]$ tail -f zmcontrol_start.out
            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

  2. #2
    Join Date
    Jan 2008
    Atlanta, GA
    Rep Power


    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.

  3. #3
    Join Date
    Jun 2011
    Caracas Venezuela
    Rep Power


    Try sudoers and complete routes to zimbra commands.

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

Similar Threads

  1. Replies: 4
    Last Post: 04-01-2013, 06:34 AM
  2. Zimbra Crashes every day
    By feiticeir0 in forum Administrators
    Replies: 10
    Last Post: 10-13-2011, 06:53 AM
  3. problema durante la instalacion
    By showmanchoyin in forum Spanish
    Replies: 18
    Last Post: 09-07-2011, 09:44 AM
  4. [SOLVED] Upgraded to 5.0 OSS - Sendmail Problem
    By Chewie71 in forum Installation
    Replies: 11
    Last Post: 12-28-2007, 06:07 PM
  5. 3.0 to 4.5.3 Upgrade failed (mysql error)
    By dealt in forum Installation
    Replies: 35
    Last Post: 03-19-2007, 10:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts