WHMCS : Daily Cron Run Warning in Admin Panel

If you have setup WHMCS on a server and migrated to new server or changed your hosting provider, chances are you gonna restore your WHMCS installation. One of the common problem is tough you set up cron job, WHMCS will not pick it up and displays error in Admin area.

View post on imgur.com

How do we fix WHMCS – Automation : Daily Cron Job Error?

View post on imgur.com

from the WHMCS admin panel, copy the command WHMCS displays in Cron Status (above screen). SSH to your sever with root or run the below query with sudo command

/opt/cpanel/ea-php73/root/usr/bin/php -q /home/<home dir>/public_html/<whmcs dir>/crons/cron.php all -F -vvv

 

all : run all jobs

-F : force execute

-vvv : verbosity of command line output

the output will be like

 

View post on imgur.com

and this should address the issue. Now add it to cron job from cPanel to run once a day

View post on imgur.com

View post on imgur.com

 

WHMCS Automation Task Utility: all

==================================

Daily Cron Automation Mode

Queuing Tasks

————-
Mask Out Details

—————————

 

0/33 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   0% < 1 sec/< 1 sec

 

4/33 [▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░]  12% < 1 sec/< 1

 

7/33 [▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░]  21% < 1 sec/< 1 sec

 

10/33 [▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░]  30% < 1 sec/< 1 sec

 

14/33 [▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░]  42%  1 sec/2 secs

 

20/33 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░]  60%  1 sec/2 secs

 

24/33 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░]  72%  1 sec/1 sec

 

30/33 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░]  90%  1 sec/1 sec

 

33/33 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%  1 sec/1 sec

———————-

4/4 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% < 1 sec/< 1 sec

[OK] Completed

 

WHMCS – Automation : Daily Cron issue reAppeared

In some cases, seems this issue resolves for a day and reappears next day, lets fix this issue. SSH to your server as root and configure cron job ourself. Just to track logs I’m about to create a new user – if you want you can do this else use a directory to track logs.

Create a new user
useradd cplogs

navigate to ‘cplogs’ users directory
cd /home/cplogs/

create a log file to trace logs
vim cronlog.txt
and type following keys form keyboard, in order to get out of VIM editor
Esc : w q !

lets set up a cron job manually, which runs everyday at 9 am and write logs to ‘cronlog.txt’ file

Access Cronjob file with below command
crontab -e

get into the INSERT mode by pressing ‘i’ key from the keyboard

* 9 * * * /opt/cpanel/ea-php73/root/usr/bin/php -q /home/--your-user--/public_html/--WHMCS-Admin-Dir--/crons/cron.php -F -vvv > /home/cplogs/cronlog.txt 2>&1

View post on imgur.com

1. As explained above its force and display verbose
2. we have given path to write logs, in our case its in ‘/home/cplogs/cronlog.txt’
3. 2<&1 write both error & success logs to the cronlog.txt

Once the cron has executed successfully, log file look like

View post on imgur.com

and Cron job status

View post on imgur.com

Hope this address your issue, please leave a comment and let me know if the tutorial was helpful

Leave a comment