script completes 100% manually but not when scheduled

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
getut
Posts: 1
Joined: Wed May 13, 2020 6:23 pm

script completes 100% manually but not when scheduled

Post by getut »

I have a script that sends managers an email when their subordinates mailboxes are above 95% full.
It basically builds a tmp file in /tmp that contains massaged output of zmprov gqu localhost.

If I run the script AS ZIMBRA USER from the terminal it runs as expected every time including putting the contents of the temp file in the form email.

If I schedule the script as Zimbra user (crontab -e as zimbra), the script runs fine and generates the email but the contents of the temp file dont get appended.

I have tried moving the tmp files out of the tmp folder and into the same folder I am running the script from, but same results.
User avatar
JDunphy
Outstanding Member
Outstanding Member
Posts: 901
Joined: Fri Sep 12, 2014 11:18 pm
Location: Victoria, BC
ZCS/ZD Version: 9.0.0_P39 NETWORK Edition

Re: script completes 100% manually but not when scheduled

Post by JDunphy »

Could be a few things... try adding this after your #!/bin/bash

Code: Select all

source `dirname $0`/zmshutil || exit 1
zmsetvars
This will setup the environment and is how many other zimbra cron job scripts do it. You can also look in the cron logs for the exact error message.

Jim
Post Reply