Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: cron witch user Zimbra not run

  1. #1
    Join Date
    Jan 2009
    Posts
    9
    Rep Power
    6

    Default cron witch user Zimbra not run

    Hello Administrators!!
    My name is David from Argentina, I have a problem witch cron on zimbra user...
    My script only execute the following command:

    !#/bin/bash
    FECHA=`date -d "a day ago" +%Y-%m-%d`
    mkdir -p /opt/zimbra/zmstat/$FECHA/chart
    cd /opt/zimbra/bin
    ./zmstat-chart -s /opt/zimbra/zmstat/$FECHA/ -d /opt/zimbra/zmstat/$FECHA/chart/

    In manual mode, the execution is successful, but the execution in cron not run correctly... He only create the directory "chart" but not execute the command "zmchart..."
    Why?? any ideas??
    Thank you very much, and I'm sorry, my english isn't very good..jeje. David.

  2. #2
    Join Date
    Oct 2005
    Location
    Thatcher, AZ
    Posts
    5,606
    Rep Power
    21

    Default

    Hello, and welcome to the Zimbra Forums!

    Are you executing the cron job as the Zimbra user?

    Can we see

    crontab -u zimbra -l

    ?

  3. #3
    Join Date
    Jan 2009
    Posts
    9
    Rep Power
    6

    Default cron zimbra

    hello and thanks for you reply!!!

    my crontab of zimbra is:

    crontab -u zimbra -l
    # ZIMBRASTART -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRAEND
    #
    # Log pruning
    #
    30 2 * * * find /opt/zimbra/log/ -type f -name \*.log\* -mtime +8 -exec rm {} \; > /dev/null 2>&1
    35 2 * * * find /opt/zimbra/log/ -type f -name \*.out.???????????? -mtime +8 -exec rm {} \; > /dev/null 2>&1
    #
    # Status logging
    #
    */2 * * * * /opt/zimbra/libexec/zmstatuslog
    */10 * * * * /opt/zimbra/libexec/zmdisklog
    #
    # Backups
    #
    # BACKUP BEGIN
    0 1 * * 6 /opt/zimbra/bin/zmbackup
    0 0 * * * /opt/zimbra/bin/zmbackup -del 1m
    # BACKUP END
    #
    # crontab.mta
    #
    #
    # Queue logging
    #
    0,10,20,30,40,50 * * * * /opt/zimbra/libexec/zmqueuelog
    #
    # Spam training
    #
    0 23 * * * /opt/zimbra/bin/zmtrainsa >> /opt/zimbra/log/spamtrain.log 2>&1
    #
    # Spam training cleanup
    #
    45 23 * * * /opt/zimbra/bin/zmtrainsa --cleanup >> /opt/zimbra/log/spamtrain.log 2>&1
    #
    # Dspam cleanup
    #
    0 1 * * * [ -d /opt/zimbra/data/dspam/data/z/i/zimbra/zimbra.sig ] && find /opt/zimbra/dspam/var/dspam/data/z/i/zimbra/zimbra.sig/ -type f -name \*sig -mtime +7 -exec rm {} \; > /dev/null 2>&1
    8 4 * * * [ -f /opt/zimbra/data/dspam/system.log ] && /opt/zimbra/dspam/bin/dspam_logrotate -a 60 -l /opt/zimbra/data/dspam/system.log
    8 8 * * * [ -f /opt/zimbra/data/dspam/data/z/i/zimbra/zimbra.log ] && /opt/zimbra/dspam/bin/dspam_logrotate -a 60 -l /opt/zimbra/data/dspam/data/z/i/zimbra/zimbra.log
    #
    # Spam Bayes auto-expiry
    #
    20 23 * * * /opt/zimbra/libexec/sa-learn -p /opt/zimbra/conf/salocal.cf --dbpath /opt/zimbra/data/amavisd/.spamassassin --siteconfigpath /opt/zimbra/conf/spamassassin --force-expire --sync > /dev/null 2>&1
    #
    # Clean up amavisd/tmp
    #
    15 5,20 * * * find /opt/zimbra/data/amavisd/tmp -maxdepth 1 -type d -name 'amavis-*' -mtime +1 -exec rm -rf {} \; > /dev/null 2>&1
    #
    # Clean up the quarantine dir
    #
    0 1 * * * find /opt/zimbra/data/amavisd/quarantine -type f -mtime +7 -exec rm -f {} \; > /dev/null 2>&1

    # ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART

    #####SCRIPT GENERATION ZMSTAT-CHART######
    10 12 * * * /opt/zimbra/zmstat/repor-zimbra.sh

    Thank you very much!

  4. #4
    Join Date
    Oct 2005
    Location
    Thatcher, AZ
    Posts
    5,606
    Rep Power
    21

    Default

    What are the permissions on zmstat-chart

    ls -l zmstat-chart

  5. #5
    Join Date
    Jan 2009
    Posts
    9
    Rep Power
    6

    Default zmstat-chart

    the permissions on zimbra-chart are
    -rwxr-xr-x 1 root root 1613 Nov 17 08:10 zmstat-chart

  6. #6
    Join Date
    Jul 2007
    Location
    Baltimore
    Posts
    1,649
    Rep Power
    11

    Default

    why not instead of

    Code:
    cd /opt/zimbra/bin
    ./zmstat-chart -s /opt/zimbra/zmstat/$FECHA/ -d /opt/zimbra/zmstat/$FECHA/chart/
    you just do

    Code:
    /opt/zimbra/bin/zmstat-chart -s /opt/zimbra/zmstat/$FECHA/ -d /opt/zimbra/zmstat/$FECHA/chart/

  7. #7
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,017
    Rep Power
    25

    Default

    Should it not be #! for the shell directive ?

  8. #8
    Join Date
    Jan 2009
    Posts
    9
    Rep Power
    6

    Default cron zimbra

    hi!! In the first instance of script, the command be:
    /opt/zimbra/bin/zmstat-chart... -d /... but he doesn't nothing...
    I don't understend, why?? I'm execute the script and run correctly, but in the cron no...

  9. #9
    Join Date
    Jul 2007
    Location
    Baltimore
    Posts
    1,649
    Rep Power
    11

    Default

    did you see what uxbod said?

    when you're logged in, all scripts run in the shell you're currently in, most likely bash by default.

    when scripts are run from crontab they are not run from a shell so you must specify the shell correctly it's supposed to run in. if you really have !#/bin/bash then that would explain it.

  10. #10
    Join Date
    Oct 2005
    Location
    Thatcher, AZ
    Posts
    5,606
    Rep Power
    21

    Default

    The file is owned by root. If you're executing cron from zimbra, you need to change the perms to zimbra:zimbra

Similar Threads

  1. Replies: 22
    Last Post: 12-02-2007, 05:05 PM
  2. Error loading on Mac OS X 10.4.10 server PPC
    By qprcanada in forum Installation
    Replies: 7
    Last Post: 10-26-2007, 07:25 AM
  3. Can't start Zimbra!
    By zibra in forum Administrators
    Replies: 5
    Last Post: 03-22-2007, 12:34 PM
  4. huge log size
    By rmvg in forum Administrators
    Replies: 5
    Last Post: 01-02-2007, 10:39 AM
  5. 3.1 on FC4 problems
    By cohnhead in forum Installation
    Replies: 8
    Last Post: 05-26-2006, 12:16 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
  •