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 01-14-2009, 06:55 AM
Junior Member
 
Posts: 9
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.
Reply With Quote
  #2 (permalink)  
Old 01-14-2009, 07:36 AM
Former Zimbran
 
Posts: 5,606
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

?
Reply With Quote
  #3 (permalink)  
Old 01-14-2009, 07:46 AM
Junior Member
 
Posts: 9
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!
Reply With Quote
  #4 (permalink)  
Old 01-14-2009, 08:08 AM
Former Zimbran
 
Posts: 5,606
Default

What are the permissions on zmstat-chart

ls -l zmstat-chart
Reply With Quote
  #5 (permalink)  
Old 01-14-2009, 08:36 AM
Junior Member
 
Posts: 9
Default zmstat-chart

the permissions on zimbra-chart are
-rwxr-xr-x 1 root root 1613 Nov 17 08:10 zmstat-chart
Reply With Quote
  #6 (permalink)  
Old 01-14-2009, 11:25 AM
Moderator
 
Posts: 1,554
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/
Reply With Quote
  #7 (permalink)  
Old 01-14-2009, 11:27 AM
Moderator
 
Posts: 7,928
Default

Should it not be #! for the shell directive ?
__________________
Reply With Quote
  #8 (permalink)  
Old 01-15-2009, 05:09 AM
Junior Member
 
Posts: 9
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...
Reply With Quote
  #9 (permalink)  
Old 01-15-2009, 05:24 AM
Moderator
 
Posts: 1,554
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.
Reply With Quote
  #10 (permalink)  
Old 01-15-2009, 05:29 AM
Former Zimbran
 
Posts: 5,606
Default

The file is owned by root. If you're executing cron from zimbra, you need to change the perms to zimbra:zimbra
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.