Cron job is not running

Category: Cpanel

macmike78
Asked:
2013-10-31 7:58 am EST

Hits: 1,189
I've tried just about everything to get my cron script to work but am not having any luck. I've been through your mini tutorial several times too! Here's what I'm trying to run... /home/MYUSERNAMER/public_html/DOMAIN/cartbookopencartsync/cronjob/batch-opencart-fa.sh and I've also tried setting it up so that it points directly to the php that the above script attempts to trigger by using your tutorial. Nothing I try works. Can you help? Someone recommend this?... wget -q -O /dev/null http://www.yourdomain.com/cartbookopencartsync/opencart/accounting/sync-opencart-fa.php - Will that work? Thanks inmotion!

You must login before you can ask a follow up question.

You must login before you can submit an answer.

& by "DOMAIN" - I mean the folder name. - Thanks!
macmike78
22 Points
2013-10-31 07:59 am EST

OTHER ANSWERS

0

BradM
Staff
5,391 Points
2013-10-31 9:11 am EST
Hi macmike78,

Sorry to hear our cron setup article didn't help. The first thing I would review is whether the cron is running or not. If it is not running, that's one thing. If it is running however, the script you're executing may not be doing what you want it to do.

Cron Email Alerts


I suggest setting up your cron job to send you an email when it runs. In this way, you can tell if the cron job is at least executing. You can find more information about setting up an automated email when your cron runs here:

Why is my cron job not emailing me?

Let us know what results you get and we'll start troubleshooting again from there with you.

Thanks!
- Brad

You must login before you can post a comment about this answer.

I did that several times too (sorry, should have mentioned). It always came back like this... /home/USER/public_html/DIRECTORY/cartbookopencartsync/cronjob/batch-opencart-fa.sh: line 4: cd: /var/www/html/DIRECTORY/cartbookopencartsync/opencart/accounting: No such file or directory

I've tried tweaking the path several times and even when I send it directly to the php file that the .sh command points to - it still says no file even though it's there.
macmike78
22 Points
2013-10-31 9:17 am EST
OK, so it sounds like the script is saying, "file does not exist" when clearly it does?

Can you give us the line of code that is calling the file? I'm curious to see. I'm not sure why it's calling /var/www/html if you explicitly set it to /home/USER/...

We want to make sure that your path is beginning with a forward slash, that it's an absolute path.
BradM
5,391 Points
Staff
2013-10-31 9:52 am EST
#!/bin/sh
umask 002

cd /var/www/html/cartbookopencartsync/opencart/accounting

/usr/bin/php -q sync-opencart-fa.php

Thanks Brad!
macmike78
22 Points
2013-10-31 10:03 am EST
I'm not sure how you have your account setup, but is there a reason you're using this?

cd /var/www/html/cartbookopencartsync/opencart/accounting

Have you tried this?

cd /home/USER/public_html/cartbookopencartsync/opencart/accounting
BradM
5,391 Points
Staff
2013-10-31 10:07 am EST
Got it! Went to use the WGET method I sent earlier but switched to your Curl fix & it worked like a charm! Thanks!!
macmike78
22 Points
2013-10-31 12:02 pm EST
Hi macmike78, glad to hear you got it fixed! Was it just a wget / curl issue, or did you have to update the path or do anything else?
BradM
5,391 Points
Staff
2013-10-31 1:31 pm EST
nope - that was is. guess I didn't thoroughly understand in the beginning about going that route. All is well. It was just wget/curl. Thanks!
macmike78
22 Points
2013-10-31 5:06 pm EST
Like this Question?

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!