Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > VodaHost Web Hosting Support > CPanel - Control Panel

Notices

CPanel - Control Panel All Cpanel questions and issues.

Reply
 
LinkBack Thread Tools
  #1  
Old 12-11-2007, 08:58 AM
Special Status
 
Join Date: Dec 2007
Posts: 40
Lightbulb Cron Jobs: Explanation and Examples

Just in case you were wondering what a "cron job" was that keeps coming up in the forums, I found this 'primer' that seems to be of use to some of those in my office.....


Scheduled Postings and Cron Jobs

by Arvind Satyanarayan

Co-authored by Elise Bauer and Arvind Satyanarayan.
Tutorial cross posted on Movalog and Learning Movable Type


What is a Cron Job?

Cron is a task scheduler for unix servers (VodaHost allows Unix/Cron programming). A cron job is a specific task that runs a certain number of times per minute, day, week, or month on your server. For example, you can use a cron job to automate a daily MySQL database backup. The main problem with cron jobs is that if they aren't properly configured they can cause high server loads which may result in suspension of your site with your web host. If you are able, configure your cron job so that the results of running the scheduled script are emailed to you.
There are two main ways by which you create a cron job on your server: cPanel, and using shell access to your server. Cpanel is the easiest way; shell access requires knowledge of UNIX editing commands and should only be attempted by those familiar with such commands.

Using cPanel

If your webhost has cPanel installed (VodaHost does have cPanel), search for the cron command in cPanel. You may be presented with a page where you select your experience level - standard or advanced. Presented are instructions for both.

Standard

Using the standard function in cPanel, the cron job editing screen should look something like this:
(click to view)
Your email needs to go in the textbox at the top of the screen so that the results of running the script are emailed to you. The command to be run is
cd <path to mt>; ./tools/run-periodic-tasks

Substitute <path to mt> with the path to your MT cgi files.
For example, if your MT installation is in your cgi bin, it might look like this:
cd /home/username/cgi-bin/; ./tools/run-periodic-tasks

If your MT installation is in your public_html directory, it could look like this:
cd /home/username/public_html/path/to/mt/; ./tools/run-periodic-tasks

It should be set to run every 15 minutes of every hour, every day, every weekday and every month.

Advanced

Using the Advanced function in cPanel, you will be presented with a different screen. Fill it out as shown below:
(click to view)
Substitute "arvinds" with your email at the top. The cron should be set to run
*/15 * * * * (every fifteen minutes of every hour of every day, every weekday, every month). The command to be run is
cd <path to mt>; ./tools/run-periodic-tasks


Using Shell Access


The Shell Access method is explained in the MT Manual. At the time of this writing, although the steps outlined in the manual are correct, the crontab command is not.
1. Log into your server.
2. Get into your crontab editor
crontab -e

3. Add the following command:
0,15,30,45 * * * * cd <path to mt>; ./tools/run-periodic-tasks

Where your path to mt is your specific path to your MT files.
This command instructs cron to run the script every 15 minutes of every hour of every day. Make sure this command is exactly as written.

Troubleshooting

There have been many errors experienced during setting this up. The first being an MT.pm error. At the time of writing this tutorial, the documentation was incorrect as the command to be run was not correct. Make sure you use the command to run as shown in this tutorial.
If you get a permission denied error make sure the run-periodic-tasks script has 755 permissions (the same permissions as all the cgi files)





If you get the error message:
You have scheduled posts but have not entered a Remote Services username in your profile, or you don't have a Movable Type proof-of-purchase. You need to do so before scheduled posts will be released.
This is a weird bug in MT at the moment. This error message does not affect anything. You can ignore it.

Scheduling Posts

With the cron job set up you are now ready to schedule your weblog posts. On the Edit Entry page of the entry that you would like to schedule for a future posting, scroll down to the bottom of the page to where you see "Post Status".

You can now select "draft", "publish", or "future". Select "future" and adjust the date and time for the date and time that you want the post published.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 10:51 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC7
2007 VodaHost.com - All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54