cron job not fully working

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
rtkluttz
Posts: 27
Joined: Mon May 06, 2019 12:00 pm

cron job not fully working

Post by rtkluttz »

I have a script that builds output to a temporary file with quota warnings for users approaching quota. I get two different results with it.

When running the script manually as the zimbra user, it works as expected. But when the exact same script runs from the cron task it generates the email but does not populate the output of the quota warnings.

Where exactly are the error logs for these cron jobs? I can see cron in general firing off in syslog, but nothing specific about this one anywhere that I can find.
User avatar
DualBoot
Elite member
Elite member
Posts: 1326
Joined: Mon Apr 18, 2016 8:18 pm
Location: France - Earth
ZCS/ZD Version: ZCS FLOSS - 8.8.15 Mutli servers
Contact:

Re: cron job not fully working

Post by DualBoot »

Hello,

with your description it seems to be a problem about rights. You should be able to run your cron manually with its user associated with to get the error.
You can also add some options in your script to log error.

Regards,
rtkluttz
Posts: 27
Joined: Mon May 06, 2019 12:00 pm

Re: cron job not fully working

Post by rtkluttz »

Unless I am misunderstanding that is what I'm doing when I run the same script as the zimbra user.

From my understanding when it runs as a cron job it runs in the context as the zimbra user and when I run it as that, it completes fully with no errors and properly puts the temp file contents into the email.
rtkluttz
Posts: 27
Joined: Mon May 06, 2019 12:00 pm

Re: cron job not fully working

Post by rtkluttz »

I have even added a > logfile.log to the end of the line in my cron and not getting any useful output, it just spit out an empty file. Can someone please tell me where I can look to get useful diagnostic info on why running the script as zimbra works but letting it fire via cron as zimbra fails (partially).

Again, the script fires, but when fired via cron the contents of the temp file do not get inserted into the body of the email the same way they do when I run it manually. The email gets generated and the non-changing portion gets emailed in the body... just the temp file contents don't go.
User avatar
DualBoot
Elite member
Elite member
Posts: 1326
Joined: Mon Apr 18, 2016 8:18 pm
Location: France - Earth
ZCS/ZD Version: ZCS FLOSS - 8.8.15 Mutli servers
Contact:

Re: cron job not fully working

Post by DualBoot »

Can you show us the content of the cron ?
Regards,
Post Reply