Cannot get cronjob to run in cpanel

Sunlander

Well-Known Member
May 7, 2018
65
4
8
UK
cPanel Access Level
Root Administrator
Hi,

I have spend many days trying to get to the bottom of why my cron job wont run in cpanel. I am using a component called Acymailing and the cron jobhas stopped working. I don't know if it is a php thing (I am on php 8.0) or an issue with something on the server (I have a dedicated server).

This is my cronjob:

/usr/bin/wget -O /dev/null "https://www.mysite.co.uk/index.php?option=com_acym&ctrl=cron" > /dev/null 2>&1

I have followed an instruction on here to check what crons are set via the terminal and can see my cron jobs including the one that never runs within my site under the correct username.

The cronjob runs fine from the url it just wont run from the cpanel cronjob.

This is what I ran in the terminal based on a support suggestion in another thread:

[[email protected]****** ~]# crontab -l -u mysite
SHELL="/usr/local/cpanel/bin/jailshell"
0 1,11 * * * /usr/bin/wget -O /dev/null "https://mysite.co.uk/blm/script_blm.php" > /dev/null 2>&1
*/10 * * * * /usr/bin/wget -O /dev/null "https://mysite.co.uk/index.php?option=com_easyblog&task=cronfeed" > /dev/null 2>&1
*/14 * * * * /usr/bin/wget -O /dev/null "https://www.mysite.co.uk/index.php?option=com_easydiscuss&task=cron" >/dev/null 2>&1
*/12 * * * * /usr/bin/wget -O /dev/null "https://www.mysite.co.uk/index.php?option=com_community&task=cron" > /dev/null 2>&1
0 0,12 * * * /usr/bin/php /home/mysite/public_html/components/com_osproperty/cron.php >/dev/null 2>&1
*/16 * * * * /usr/bin/php /home/mysite/public_html/components/com_jreviews_addons/queue/worker-many.php >/dev/null 2>&1
0,10 * * * * /usr/bin/php /home/mysite/public_html/jreviewscron.php > /dev/null 2>&1
0,10 * * * * /usr/bin/wget -O /dev/null "https://www.mysite.co.uk/index.php?option=com_acym&ctrl=cron" > /dev/null 2>&1

I am not sure what jailshell is that came back in the results. I also do recall seeing this in emails from the server:


/usr/local/cpanel/bin/jailshell: https://www.mysite.co.uk/index.php?option=com_acym: No such file or directory


Can anyone advise as to what could be wrong/how I get it working?

Kind regards
 
Last edited by a moderator:

andrew.n

Well-Known Member
Jun 9, 2020
930
345
63
EU
cPanel Access Level
Root Administrator
Why don't you run this with direct paths instead of wget? I think that would be a better solution here.
 

Sunlander

Well-Known Member
May 7, 2018
65
4
8
UK
cPanel Access Level
Root Administrator
Hi,

thanks for responding.
Could you provide an example what a direct path looks like? I am a complete novice with cronjobs and have tried all sorts of solutions I have found online but none work so far. I also wanted to know if that jailbreak message was anything to be concerned about.

Kind regards
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
12,499
1,971
363
cPanel Access Level
Root Administrator
You can read more about jailshell here:


Since these all seem to be PHP scripts, I would just run them all like you have in lines 5-7, where you call /usr/bin/php directly. Can you try that and see if that gives you better results?
 

Sunlander

Well-Known Member
May 7, 2018
65
4
8
UK
cPanel Access Level
Root Administrator
Hi CPrex,

thanks for your reply

I just tried this:

/usr/bin/php /home/mysite/public_html/index.php?option=com_acym&ctrl=cron > /dev/null 2>&1

Is this the correct way to write it? as those other examples go straight to an actual php file where the above is a url link?

Do I need this jailshell? Could that be part of the problem why it isn't firing?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
12,499
1,971
363
cPanel Access Level
Root Administrator
I still think there's some confusion. Let's not worry about jailshell for now.

Do you need the PHP scripts to run like they are in a browser? Calling the path with /home isn't a link like what a browser would use.

Is this a certain piece of software you purchased? If so, that company may be able to tell you how to run the cron jobs.
 

Sunlander

Well-Known Member
May 7, 2018
65
4
8
UK
cPanel Access Level
Root Administrator
I have been in contact with the component developer acyba.com and this is what they said:


"If you want to use your own server cron job instead, you have to properly configure a cron job. Just placing your cron job URL is not good enough because you also need to configure a command which will try to open cron job URL and trigger it that way

For example, something like this

wget --no-check-certificate -O /dev/null "href="https://www.mysite.com/index.php?option=com_acym&ctrl=cron">https://www.mysite.com/index.php?option=com_acym&ctrl=cron" > /dev/null 2>&1

"

But i couldn't get that to fire.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
12,499
1,971
363
cPanel Access Level
Root Administrator
I would guess that's just a formatting issue from the way they sent you the code. Can you try this manually on the command line to see if it worsk for you there?

Code:
wget --no-check-certificate https://www.mysite.com/index.php?option=com_acym&ctrl=cron > /dev/null 2>&1
 

Sunlander

Well-Known Member
May 7, 2018
65
4
8
UK
cPanel Access Level
Root Administrator
Hi,

this is what is returned when I run that in command line:

[[email protected]**** ~]# wget --no-check-certificate https://www.mysite.com/index.php?option=com_acym&ctrl=cron > /dev/null 2>&1
[1] 25113
[[email protected]**** ~]# --2022-08-31 18:12:38-- https://www.mysite.com/index.php?option=com_acym
Resolving www.mysite.com (www.mysite.com)... ***.***.**.**
Connecting to www.mysite.com (www.mysite.com)|**.***.**.**|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.php?option=com_acym’

[ <=> ] 18,788 --.-K/s in 0s

2022-08-31 18:12:38 (177 MB/s) - ‘index.php?option=com_acym’ saved [18788]
 

Sunlander

Well-Known Member
May 7, 2018
65
4
8
UK
cPanel Access Level
Root Administrator
I am still trying to figure it out sadly.

I found that file (i didn't know where it was saving). Anyway, it is a 500 error apparently, but I dont know what is triggering it or ho
 

Sunlander

Well-Known Member
May 7, 2018
65
4
8
UK
cPanel Access Level
Root Administrator
I am still trying to figure it out sadly.

I found that file (i didn't know where it was saving). Anyway, it is a 500 error apparently, but I dont know what is triggering it or how to identify. Could it be a permission issue? If yes, how would i be able to check and correct this?

I tried to post the output of that files on here but it throws an error and wouldn't save.
 

Sunlander

Well-Known Member
May 7, 2018
65
4
8
UK
cPanel Access Level
Root Administrator
Thats my problem I am on a dedicated server on my own as my host dont manage dedicated servers. I have root access I just dont know the commands to write to investigate
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
12,499
1,971
363
cPanel Access Level
Root Administrator
Thanks for the additional details. If you're seeing a 500 error, it's best to check the Apache logs while that error is happening with this command:

Code:
tail -f /etc/apache2/logs/error_log
That will show you the logs in real-time while they are happening, so if you can reproduce the issue and make it happen, you'll see what is logged on the server.
 

Sunlander

Well-Known Member
May 7, 2018
65
4
8
UK
cPanel Access Level
Root Administrator
Hi Cprex,

thank you!

This is what the outcome is of that command (I do not have wordpress so not sure what wp-login.php is) also it wont let me post all the output here so just posting the first 2 lines which are basically repeated:

[Thu Sep 01 20:12:07.951424 2022] [:error] [pid 20394:tid 47308845602560] [client 171.244.17.110:34460] File does not exist: /var/www/html/wp-login.php
[Thu Sep 01 20:26:23.737416 2022] [proxy_fcgi:error] [pid 31549:tid 47307544590080] [client 179.70.100.34:39474] AH01071: Got error 'Primary script unknown'
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
12,499
1,971
363
cPanel Access Level
Root Administrator
Thanks for that. The first line wouldn't be related, but the second one could be, although it doesn't tell us much.

Since you have root access to the server, could you create a support ticket with our team so we can check this out directly on the system?