SOLVED WHMAPI1 works from SSH, but not in CRON job

domeneas

Active Member
Sep 20, 2013
43
5
58
cPanel Access Level
Root Administrator
I wrote a script that tells me what users have sent more than X emails in X time when they pass a threshhold.

I use ($file2 contains a UNIX timestamp):

while IFS= read -r file2
do
whmapi1 emailtrack_user_stats starttime $file2 > email_success_data.txt
done < email_success_time.txt

to dump the data to a file. I can run my whole script in SSH by running the main .sh file and it's beautiful. Great little email and phone app reports of possible outgoing spam.

When I run it via a CRON job though, it returns:

/root/email_success.sh: line 9: whmapi1: command not found

Any fixes out there? Something I don't know about WHMAPI1?

Thanks.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,608
79
458
cPanel Access Level
Root Administrator
The whmapi1 binary is not in the PATH environment used by cron. You can fix this in one of two ways:

1. Add the whmapi1 directory path to PATH in either cron or your script; or
2. Use the full path to the whmap1 binary in your script