WHMAPI1 works from SSH, but not in CRON job
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.
-
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 0 -
Thanks, spot on. which whmapi1 gave me the path and I just added that to the script and called it directly. 0 -
I faced similar issue. Here is the solution /usr/local/cpanel/bin/whmapi1 createacct username='acc100' domain='test.srilanka.com' 0 -
I would just like to add that I had the same problem again. Googled it, and found this thread, my own thread, 4 years later, giving me the solution...again. /usr/sbin/whmapi1 editquota user=$username quota=$newquota 0
Please sign in to leave a comment.
Comments
4 comments