Correct syntax for cron in Cpanel
-
Hi there
The other day, although there’d been no problem of any sort with a Drupal based site sharing a hosting account with 2 add-on domains using WordPress, I suddenly had an alert of resource overuse leading to them being taken offline, showing 508 server error.
I had not changed anything on them apart from normal updates the day before. It took a long time to identify one of the 3 (WordPress) as being behind this, as taking it offline caused the problem to go away and number of processes and virtual memory use to shoot up, if returned, even in maintenance mode. It was barely possible to do anything, even stay logged in for a few moments as the resource overuse would force them offline every few seconds for about 1.5 days long. For the night, I had to completely take it offline so the others could be online.
Even disabling all or most of the plugins yesterday and enabling them one by one did not lead to clear results, as the specific plugins I may have considered rogue were not causing problems on the other WordPress site. Also using a database back-up from a month before at first helped and then resource use shot up after a while. Anyway, right now, things have somehow cooled off as yesterday I did not have this debilitating resource use leading to site shutdown and I even restored the original database and resource use has returned more or less to normal, but I read somewhere this is often caused by cron and solved by making it not run automatically but by a script in Cpanel.
The question is, why was that not an issue before?The next step would have been trying to remove all WordPress core + plugin + theme files and replace them, though Wordfence did not show any unusual changed individual files. I would have used the db back-up of a month ago.
Even if I am not sure what caused this, I decided to disable automatic cron running in wp-config.php (define(“DISABLE_WP_CRON”, true);, placed at the bottom) and use scripts recommended on some sites and in the Cpanel, but something seems not to be ok as the cron daemon reported not being able to open the script location.
One tutorial recommended:
/usr/bin/wget -O /dev/null https://www.mydomain.com/wp-cron.php?doing_wp_cronEmail alert:
–2018-08-16 18:00:02– https://www.mydomain.com/wp-cron.php?doing_wp_cron
Resolving http://www.mydomain.com (www.mydomain.com)… xxx.34.xxx.201
Connecting to http://www.mydomain.com (www.mydomain.com)|xxx.34.xxx.201|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 0 [text/html]
Saving to: ‘/dev/null’0K 0.00 =0s
2018-08-16 18:00:04 (0.00 B/s) – ‘/dev/null’ saved [0/0]
Another tutorial suggested:
wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1Email alert:
Could not open input file: /home/adm12000/mydomain.com/wp-cron.php?doing_wp_cron
In the Cpanel itself of my web host, they recommend:
/usr/local/bin/ea-php56 /home/adm12000/domain_path/path/to/cron/scriptSo I tried:
/usr/local/bin/ea-php56 /home/adm12000/mydomain/wp-cron.php?doing_wp_cron(because my site is in the folder “mydomain.com”, though NOT sure I get this right) and
/usr/local/bin/ea-php56 /home/adm12382/https://www.mydomain.com/wp-cron.php?doing_wp_cron(this does not feel right 😉 )wget -q -O - https://www.mydomain.com/wp-cron.php?doing_wp_cron >/dev/null
(for this, which is currently being used: no email alert so I’m not sure it’s running or not)So questions:
- Specifically for Cpanel, what’s the correct syntax for running cron? I’m not a coding expert, so I request being specific
- What other explanation and solution could there be for this sudden resource use surge, as before it turned up 2 days ago, the sites had peacefully co-existed with no similar issue and at least since most of yesterday, Cpanel statistics show this to be in normal ranges, nothing in red or critical .
As I’m typing this, with ALL plugins running for the culprit site, virtual memory use at 6.66% (136.6MB of 2GB), physical memory 6.06% (total 2GB), number of processes 1%, CPU use reads 0%, I/O 0%, etc.
At the height of the issue the other day, at least 2 of the above readings where CONSTANTLY in the red, at or towards 100%. Now all is green or mostly, since most of yesterday.I would appreciate some help.
Regards
The topic ‘Correct syntax for cron in Cpanel’ is closed to new replies.