Page 1 of 2

Help with Cron Job and ImportCumulusFile script

Posted: Sun 29 Sep 2013 12:08 am
by captzero
Hi All,
I've taken the plunge into mysql databases and have been able to import the dayfile.txt file using the ImportCumulusFile script in the wiki. I've been able to see some data using Kerry's (tobyspond) samples. I already upload the dayfile.txt file to my server using cumulus toolbox just after midnight each day. The script says It's possible to run this script from a PHP command line, eg via a cron job.....but this is where I'm stuck.
I've tried to using cPanel to create a cron job but nothing happens. Although I've searched the forum and have googled, I'm lost when it comes to creating a cron job to import the dayfile.txt into the database once a day. Any help with this will be much appreciated.

Re: Help with Cron Job and ImportCumulusFile script

Posted: Mon 30 Sep 2013 7:30 am
by mcrossley
Dan, what command line and parameters are you putting into the cron job?

Re: Help with Cron Job and ImportCumulusFile script

Posted: Mon 30 Sep 2013 8:02 am
by captzero
Hi Mark,

This is what I have....

Code: Select all

wget http://www.brisbaneliveweather.com/ImportCumulusFile.php?type=Dayfile&key=******&table=Dayfile&file=dayfile.txt


Set for 10 mins past midnight once a day (but for testing every minute). I've included my email address as part of the cron setup set up but haven't rec'd one saying it has executed successfully.

Thanks heaps.

Re: Help with Cron Job and ImportCumulusFile script

Posted: Mon 30 Sep 2013 11:30 am
by mcrossley
OK a couple of things...
Are you using a commercial hosting system or self hosting?
Is wget available on your web server? (can you SSH onto the server and run the command?)
Is the web page you are trying to call on the same server as the cron job?
Have you tried running php directly rather usng wget?

Re: Help with Cron Job and ImportCumulusFile script

Posted: Mon 30 Sep 2013 12:58 pm
by captzero
Thanks again...

Are you using a commercial hosting system or self hosting? - Commercial host
Is wget available on your web server? (can you SSH onto the server and run the command?) - Ummm not sure. I'm not familiar with this
Is the web page you are trying to call on the same server as the cron job? - Yes, its in the public_html folder
Have you tried running php directly rather usng wget - yes - without success

cheers

Re: Help with Cron Job and ImportCumulusFile script

Posted: Mon 30 Sep 2013 2:27 pm
by BigOkie
captzero wrote:Thanks again...

Are you using a commercial hosting system or self hosting? - Commercial host
Is wget available on your web server? (can you SSH onto the server and run the command?) - Ummm not sure. I'm not familiar with this
Is the web page you are trying to call on the same server as the cron job? - Yes, its in the public_html folder
Have you tried running php directly rather usng wget - yes - without success

cheers
Very few commercial hosters right now allow SSH because they feel it gives users too much control over the system. Bluehost, however, does, and it's a must for me. I believe Dreamhost does as well. Not sure about your host, however, as you've not named it.

Re: Help with Cron Job and ImportCumulusFile script

Posted: Mon 30 Sep 2013 7:55 pm
by captzero
Thanks,
My host allows SSH but I'm not familiar with how to use it. I'll brush up on it.

Re: Help with Cron Job and ImportCumulusFile script

Posted: Mon 30 Sep 2013 9:36 pm
by BigOkie
captzero wrote:Thanks,
My host allows SSH but I'm not familiar with how to use it. I'll brush up on it.
once you get in using SSH, issue the following commands:

which wget
which php

Look at the output of both; they'll likely be something like '/usr/bin/wget' and '/usr/bin/php'. This essentially just lets you know where those binaries are so you can execute them via cron. I've found that on some installs the full path to the executable is required. Why, I am unsure of.

Re: Help with Cron Job and ImportCumulusFile script

Posted: Tue 01 Oct 2013 9:12 am
by captzero
Thanks again, I'll have a play over the next couple of days and let you know how I go.

Re: Help with Cron Job and ImportCumulusFile script

Posted: Fri 04 Oct 2013 8:57 pm
by captzero
Sorted. I was able to achieve this as a remote command using cumulus toolbox.

Re: Help with Cron Job and ImportCumulusFile script

Posted: Tue 15 Apr 2014 3:02 pm
by mm23
Somebody help me , please.

I need a command line for cron job to fill my realtime table using importcumusfile php. and realtime.txt in data folder. Now I am still using toolbox and importcumulus.php and everything works well, but I have a wish to fill my table every minute using cron job.

Thanks a lot

Re: Help with Cron Job and ImportCumulusFile script

Posted: Tue 15 Apr 2014 4:31 pm
by water01
Does your hosting service provide you with CPanel access, because if it does you set up Cron Jobs via Cpanel.

Re: Help with Cron Job and ImportCumulusFile script

Posted: Tue 15 Apr 2014 4:45 pm
by mm23
Yes, I have access to cpanel. When I asked the web hosting admin the same question I got the answer that I write next:

php -q /home/username/public_html/path_to_script


but something is missing because I always get the various error message depends of a command line content i wrote?

Re: Help with Cron Job and ImportCumulusFile script

Posted: Tue 15 Apr 2014 5:05 pm
by mcrossley
Can you post the command line you used?

Re: Help with Cron Job and ImportCumulusFile script

Posted: Tue 15 Apr 2014 5:09 pm
by mm23