Welcome to WebmasterWorld Guest from 54.196.238.210

Forum Moderators: bakedjake

Message Too Old, No Replies

Crontab From Command Line

     

JRobinson

4:58 pm on Feb 12, 2010 (gmt 0)

5+ Year Member



Please excuse my ignorance here, I'm just an old guy that plays around with this stuff as a hobby. I'm trying to get a script to run every hour and through an exhaustive search I've learned that I apparently have to set up a "crontab" to do this. I think I understand the concept of the '20 * * * * /path/to/file.php' command (I want it to run at 20 min past the hour) but what I don't understand and can't seem to find through searching is simply how to get the command window open or otherwise get to a command prompt so I can input the command. Can somebody help me out here?

Thanks,
Jim

rocknbil

8:34 pm on Feb 12, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome aboard JRobinson, this is not a PHP question, really It is an administration question. You set up a cron via command line to your server or via your hosting control panel. One way to access the command line of your server is via SSH, but if you are on shared or VPS/VDS hosting, this may not be possible. So most hosting services have this in their hosting control panel GUI and is easier to set up.

Log in your your hosting control panel, locate your domain, and you should see cron/crontab options. You set the frequency with with the cron runs, and just point it to this script. Let's say, daily at 12 AM; this means this script would run at midnight every day and clear out old session entries.

JRobinson

10:39 pm on Feb 12, 2010 (gmt 0)

5+ Year Member



Thank you for your reply rocknbil, sorry I posted in the wrong forum. I'm using a shared hosting thing through globat.com which I've found to be quite unrestrictive overall, but I've reached the conclusion that I must not have the proper permissions to set this up. I've been through every nook and cranny I could find in my control panel but wasn't able to find any cron options. I can set file permissions and edit my php.ini but apparently they draw the line with auto-excecuting scripts. I've got a support ticket going with the hosting company, I'll let you know how it turns out.

Thanks again,
Jim

JRobinson

6:54 pm on Feb 13, 2010 (gmt 0)

5+ Year Member



Problem Resolved. In response to my support ticket my hosting company added a "scheduled jobs" option in my control panel and I now have the script functioning as expected (archiving aviation weather reports from the NOAA server for flight simulation use). The scheduling was done through an easy to use UI so I didn't have to actually input any commands manually.

Thanks again for pointing me in the right direction rocknbil, and a special thanks to the Webmaster World community for all the answers I've found here in the past.

Jim
 

Featured Threads

Hot Threads This Week

Hot Threads This Month