Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Cron Job help

#1
[Not Solved]
Hi,

Today I tried to create my 1st cron job but it doesn't work at all.
Maybe I don't understand something because I never did this but it should work.
I want to execute script.php every for ex. 5 min 
Code:
*/5 * * * * /usr/local/bin/php /home/{nick}/public_html/{scriptname}.php

Can anyone tell me what I need to do to enable this.

Thanks in advance & sorry for any issues.

This is just for test, I hope it won't take to many resources:/
#2
[Not Solved]
Hey, I think that Cron jobs are allowed on our shared hosting accounts as long as they are not "spammy" in your case it might be tight, because execution of script every 5 min can drain some resources.

There is some tutorial and guide on how to setup cron job in c panel or shell, https://www.thesitewizard.com/general/se...-job.shtml
 
[Image: userbar.png]
[Image: polandbar4.gif]
#3
[Not Solved]
I don't think so, even with 30 min just nothing happens, this is just test script with few lines of code..
Maybe I have no rights to execute this or something like this
#4
[Not Solved]
In this case, you have to wait for the admins to respond
 
[Image: userbar.png]
[Image: polandbar4.gif]
#5
[Not Solved]
Have brought this to the attention of our Chief Guru - @un4saken. Drinks

#6
[Not Solved]
Hello,

Your cronjob is running fine according to our cron log.
 
Code:
[root@hero ~]# cat /var/log/cron | grep cma
Jan 6 15:00:03 hero CROND[20189]: (cma) CMD (/usr/local/bin/php /home/cma/public_html/{yourscriptname}.php >/dev/null 2>&1)

I've added >/dev/null 2>&1 to your cronjob so you will not get spammed by confirmation mails every 5 minutes.
Please do not email or PM me with private support requests - Use Support Section.
Don't forget to read TOS.
Never argue with idiots.
First, they'll bring you down to their level and then beat you with their experience!
[-] The following 1 user Likes un4saken's post:
  • Genesis
#7
[Not Solved]
Hello un4saken,

Thank you for your time & checking this, unfortunately this way still doesn't work

But when I use this bypass:

*/5 * * * * wget http://domain.net/{script}.php >/dev/null 2>&1

It works fine, any idea why is it script issue or maybe php path?


Thanks
#8
[Not Solved]
Maybe there's an error within the script.
Test it outside the cron job. Did it work if you call it from the browser?
Maybe you can put some debug information in the script so you can see if it's working.
#9
[Not Solved]
(01-19-2020, 05:36 PM)enzomatrix Wrote: Maybe there's an error within the script.
Test it outside the cron job. Did it work if you call it from the browser?
Maybe you can put some debug information in the script so you can see if it's working.

my script works correctly without cron, when I use different cron method than also cron works..
  




Users browsing this thread:
4 Guest(s)

Cron Job help372