Scheduled Postings and Cron Jobs

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

Future posting is a convenient new feature in MT3.1x, allowing you to create an entry and have it automatically post at a future time. But before you can use this feature you need to set up a Cron Job on your server.

What is a Cron Job?

Cron is a task scheduler for unix servers. 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, search for the cron command in cPanel. You may be presented with a page where you select your experience level - standard or advanced. Instructions for both are discussed here.


Using the standard function in cPanel, the cron job editing screen should look something like this:

Cronstandard_1(click for larger image)

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
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:
Cronadvanced_2(click for larger image)

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
  1. 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.


There have been many errors experienced during setting this up. The first being an 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.

Copyright © 2004 Elise Bauer and Arvind Satyanarayan.


Manuela said:
on Sep 26, 2004 2:48 PM | Reply

My hoster requires me to have a script URL rather than a command for the cron job. I have tried using something like but that did not work. Any idea on this is greatly appreciated. Thank you

Arvind Satyanarayan said:
on Sep 26, 2004 4:04 PM | Reply

What you need to ask your host is if you can use what we have above. To run this script you first need to change the current working directory to your mt dir (the cd <path to mt>;) bit does this, and from there to run that script, otherwise it will not work!

Manuela said:
on Oct 3, 2004 12:11 PM | Reply

That is exactly the problem. I can't use it that way. I need a workaround.

Arvind Satyanarayan said:
on Oct 3, 2004 4:07 PM | Reply

Well to my knowledge there isn't any way to do it the way you can. You'll need to either take it up with Six Apart or find a new hosts. Sorry!

didak said:
on Oct 28, 2004 12:33 AM | Reply

HI Arvind- I've followed you and Elise's tutorial and the cron jobs aren't running. Have checked and "tools" folder is indeed in place. Have also consulted with Total Choice Hosting (my host), who is very good at offering advice on their forums, but they can't offer any more, and I'm still stymied.

In the control panel I typed this last night: cd /home/USERNAME/public_html/mt/; ./tools/run-periodic-tasks

Doesn't run at all despite making all the timing changes per your tutorial also AND i'm not getting any emails either.



didak said:
on Oct 28, 2004 12:51 AM | Reply

This cross posting brings up another of my burning questions: How do you cross post without posting in each separate blog? Haven't found anything online yet about this. TIA- Dida

Arvind Satyanarayan said:
on Oct 28, 2004 8:32 AM | Reply

Hi didak I'm on TotalChoiceHosting as well. When you setup the cron can you make sure the cron sends you output of the job and once you get that output post it here.

Elise and I cross-posted by posting in each separate blog!

didak said:
on Oct 28, 2004 11:44 PM | Reply

I'm not getting any emails at this point. I was when i first configured the job (beasue I didn't include the tools folder when I updated MT-doh!), saying no such file or directory existed. I then re-did the job after FTP'ing the TOOLS folder over, and now, NOTHING!

here's my command line: cd /home/MYUSERNAME/public_html/mt/; ./tools/run-periodic-tasks (space between semi-colon and period)

set to run every 15 minutes, etc . . .


Arvind Satyanarayan said:
on Oct 28, 2004 11:45 PM | Reply

If you're not getting any emails that means the script is running fine. This may be a silly question but you are setting the posts to publish in the future right?

didak said:
on Oct 29, 2004 6:54 AM | Reply

Not a silly question at all. Which brings up the fact that FUTURE is not showing up as an option when creating an entry. I work in Opera; could it be a browser issue? (Note to self: check other browsers!) Dida

didak said:
on Oct 29, 2004 7:03 AM | Reply

Just checked- FUTURE option just doesn't appear in IE nor NX neither. Am stumped! Dida

Arvind Satyanarayan said:
on Oct 29, 2004 8:28 AM | Reply

Whilst upgrading make sure you upload all the new tmpl files!

didak said:
on Oct 29, 2004 10:20 PM | Reply

I ftp'd the entire tmpl folder, but what's the name of the latest entries template file, just to double-check? TIA-Dida

tim said:
on Oct 30, 2004 1:07 AM | Reply

I want to have it run every 15 days not 15 mins how do I set this up with cpanel advanced mode?


didak said:
on Oct 30, 2004 1:31 AM | Reply

I resent the entire tmpl folder to my server, and everything looks OK now- Dida

Arvind Satyanarayan said:
on Oct 31, 2004 6:56 PM | Reply

Hi Tim, in advanced mode it would look something like this

0 0 15 * * cd <path to mt>; ./tools/run-periodic-tasks

Ang said:
on Nov 2, 2004 12:19 AM | Reply

I've been having trouble with this as well. I had to edit run-periodic-tasks to tell it the proper path to lib & extlib. Now it's giving me the error Bad ObjectDriver config: Your DataSource directory ('./db') does not exist. However, I'm using MySQL, and I thought that was a path specified only if you were using Berkeley DB. This is an in-house server, BTW, not a hosting provider. Any advice? I'm grasping at straws here, as this is not my area.

Arvind Satyanarayan said:
on Nov 2, 2004 9:10 AM | Reply

Is the line

DataSource ./db

still in your mt.cfg ? It should not be there if you use MySQL

Ang said:
on Nov 2, 2004 9:18 PM | Reply

Hi Arvind - I've deleted that line and inexplicably I still get the same error. Is there some place else it's being called?

Ang said:
on Nov 3, 2004 12:25 AM | Reply

Follow-up to previous msg: things seem to be working now, though I don't know why. I should say that I was getting that error when trying to run run-periodic-tasks from the command line. So perhaps it just doesn't matter. In any case, thanks for your help. Great resource!

Benediktus said:
on Jan 1, 2005 8:51 AM | Reply

Hi Arvind,

I've got an error like this: "Can't ignore signal CHLD, forcing to default." So what should I do then?


Milad said:
on Jun 10, 2005 11:48 PM | Reply

I use this, but not run plz help me...!?

sam said:
on Nov 16, 2005 11:51 AM | Reply

Hi all, I've got a problem with Scheduled Postings and Cron Jobs. It works fine when I run the script manually through 'ssh'. However the problem comes up when I setup a cronjob, it comes over my site and run correctly the script ( cd ; ./tools/run-periodic-tasks ). It changes the post status from "future" to "publish" but the post is not shown in the website, what could it be? I'd appreciate your comments. Thanks sam

Prabhjot Singh said:
on May 26, 2006 10:32 AM | Reply


First of all Thanks for this article. I have a query here , basically i m new to PHP and linux. Now i have this cron link in my cpanel but what according to your Article is MT. I am not able to understand whats MT here. If you mean with the PHP file name we want to run every interval or something else. Could you please help me out. I have a script which needs to be run every 2 hrs. that script is in a fiel php loaded on my server. Now do I just need to :- cd /home/mysite/public_html/myfolder/; ./tools/myfile.php

Please help me here, it would be greatfull


Arvind Satyanarayan said:
on May 26, 2006 10:50 AM | Reply

Hi Prabhjot, this article was specifically for creating a cron job for Movable Type (MT). What you're looking for is a more general tutorial on what cron is and how to use it. However, I cron the following command to execute a php script:

php -q /path/to/php/script.php

Hope that helps

Ansgar said:
on Jun 2, 2006 12:26 PM | Reply

For Windows I recommend using VisualCron for these kind of tasks.

Best regards,


Stephen Glauser said:
on Sep 17, 2006 3:52 PM | Reply

Hey all, I've taken a few cracks at this but can't seem to get it working. I've set it up exactly as stated in the entry using cPanel Standard... as such:

cd /home/MYUSERNAME/public_html/mt/; ./tools/run-periodic-tasks

I receive an email stating the following:

/bin/sh: line 1: ./tools/run-periodic-tasks: No such file or directory

I've checked, and the file exists as it should. I'm stumped! Help, please!

Stephen Glauser said:
on Sep 17, 2006 6:39 PM | Reply

Figured it out! The one that worked for me:

cd /home/trm-gla/public_html/mt; ./tools/run-periodic-tasks

chollyson said:
on Nov 11, 2006 4:19 AM | Reply

I have tried to set up crons over and over and I keep getting the error : no such directory exists. Would you mind showing an example of the command code with actual path information? I think I have it wrong. For example, the info for yours or a fake one that is correct?

chollyson said:
on Nov 11, 2006 4:40 AM | Reply

Nevermind. I got it to work!!


Bill said:
on Nov 27, 2006 12:53 AM | Reply

So, what did you do to get it to work? Remove the forward slash after /nt?

Andy said:
on Dec 1, 2006 6:23 AM | Reply

thanks for your explains, i works good.

Pozycjonowanie said:
on Dec 4, 2006 7:11 PM | Reply

Someone else below asked this already. I am getting nailed with Spam in my guestbook for our catalog website. Is there anyway to stop

this? If not, there really isn't any point in leaving it up and active. Any help will be greatly



Pavan Kumar.Thummalapalli said:
on Dec 6, 2006 2:23 PM | Reply

/usr/local/bin/php -q /home/USERNAME/public_html/path4program

This had worked for me. Here /usr/local/bin/php is the path for my php executor.So, goto cpanel-->cronjobs-->Standard

Enter the above command and modify it to fit ur requirement.USERNAME refers to username of ur ftp accessand path4program is the exact path of ur program after /public_html.

I'm sure this will help everyone's requirement who wish to set a Cron to their program. Bye.....

susan said:
on Dec 15, 2006 8:14 PM | Reply

many thanks for this great howto, this help's me wonderfull for my work on the server kind regards susan

程控电话交换机 said:
on Jan 19, 2007 8:33 AM | Reply

That is exactly the problem. I can't use it that way

otilie said:
on Mar 8, 2007 7:50 PM | Reply

Thanks for the good and helpful informations.

shubha said:
on Mar 12, 2007 10:50 AM | Reply

i have a php script and i put it on cron by cpanel its not working from there but if i try it by browser it works file but not run by shell , can any body tell me linux command to run this dcript by cron through cpanel, please help me

Anonymous said:
on Jun 27, 2007 2:54 AM | Reply

I want to have it run every 15 days not 15 mins how do I set this up with cpanel advanced mode?

Bob said:
on Oct 10, 2007 12:34 PM | Reply

Thank you very much for this interesting Tutorial, very well written and full of information....

Muskelaufbau said:
on Dec 16, 2007 2:29 PM | Reply

Hey , thank you very much for this great stuff! Keep up your great work! Greetings Daniel

John said:
on Mar 17, 2008 9:28 AM | Reply

Hi! I really enjoyed your block, it is very interesting.

szafy metalowe said:
on Apr 28, 2008 1:40 PM | Reply

Very good article

akshay said:
on May 22, 2008 12:04 PM | Reply

hey gr8 stuff .. i have collected some more info if ur interested.. :)

prezenty said:
on May 28, 2008 6:34 PM | Reply

This is interesting article, I did not it think that it yes. Interesting it knew persons about this how much. Sorry if I wrote bad there now my English is novice and I do not it write yet good.