b2evolution b2evolution

  • Sign in
  • Sign up
  • About
  • Downloads
  • Hosting
  • Docs
  • Support
  • Sign in
  • Sign up
  • Manuals Home
  • Latest Updates
 
  1. b2evolution CMS User Manual
  2. Installation / Upgrade
  3. Advanced Setup
  4. Setting up the Scheduler
  5. Windows Scheduled Task Setup

Windows Scheduled Task Setup

Warning: The following assumes you have administrative access to the Windows server where b2Evolution is served from and that the Task Scheduler service is enabled. These instructions are valid for Windows Server 2000 and 2003. They will probably work for Windows NT with some minor changes, but really - shouldn’t you just upgrade? Also, if you frequently have to call your child/cousin/uncle/brother/grandmother to get you out of trouble with your PC, DO NOT try this. Call your child/cousin/uncle/brother/grandmother now and ask them to do it for you, before you get into trouble. You can wait patiently in the kitchen baking chocolate chip cookies to offer as a reward for a job well done. And as always, you should back up any important data before beginning.

So, you want to set your b2Evolution Scheduler to run on a regular basis using your Windows server, eh? Follow along as we explore the magic of the Windows Task Scheduler service.

First Things First

First, you’ll need to know exactly where this script resides on your system. If you don’t know already (maybe you should call that child/cousin/uncle/brother/grandmother now?), you can find it by clicking Start -> Search -> For Files and Folders from the task bar and entering cron_exec.php as the search criteria. These instructions will assume you found it at: C:\Inetpub\wwwroot\blogs\cron\cron_exec.php.

Next, we need to know where PHP is installed. You definitely have it installed already if your server is serving out delicious b2Evolution pages, so fret not. You can do that search thing again, this time entering php.exe as the search term. These instructions will assume you found it at:
C:\PHP\php.exe

PHP comes in many different flavors: Apache module, CGI module, Command Line module (CLI), etc. The preferred version to use here is the CLI version. Lets test it. Click Start -> Run… from the task bar and enter cmd. This will open the Windows command prompt. At the command line (it should look like C:\>) enter the full path to your php.exe file followed by -v (that’s [space][minus][lowercase v]) and hit Enter. It should look something like this:

C:\PHP\php.exe -v

And return something like this:

  PHP 5.1.2 (cli) (built: Jan 11 2006 16:40:00)
  Copyright (c) 1997-2006 The PHP Group
  Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

If you’re lucky, you’ll find that cli designation after the version number. If not (maybe you see a bunch of HTML, or just no CLI designation) this may still work but you should try to find the CLI executable of your PHP installation. You can check the PHP website (http://www.php.net) for details on your specific version of PHP.

For the purposes of this tutorial, we’ll assume that every thing worked peachy and that you’re using the CLI version.

Hello World

Now lets make sure that cron_exec.php script will play nicely with your php.exe file. Go back to your command prompt and enter:

C:\PHP\php.exe "C:\Inetpub\wwwroot\blogs\cron\cron_exec.php"

And it should result in the simple message:

There is no task to execute yet.

If you see any other messages or if you just get a bunch of HTML, read through these and correct what ever is wrong. If you continue to have trouble, try posting a question in the b2Evolution forums http://forums.b2evolution.net/. For instance, the first time around I got this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>b2evolution is not configured yet</title>
    </head>
    <body>
        <div style="background-color:#fee; border: 1px solid red; text-align:center; ">
            <p>This is b2evolution version 1.8-beta.</p>
            <p><strong>You cannot use the application before you finish configuration and installation.</strong></p>
            <div style="font-weight:bold; color:red;">Base configuration is not done! (see /conf/_basic_config.php)</div>
            <p>Please use the installer to finish your configuration/installation now.</p>
            <p>On most installations, the installer will probably be either <a href="install/index.php">here</a> or <a href="../install/index.php">here</a>... (but I can't be sure since I have no config info available! :P)</p>
    </div>
</body>
</html>

I fixed the problem by going through the installer, then ran the command again and got the expected message.

Putting It All Together

The final step will be to set the script to run automagically. For starters, we need to get out our Task Scheduler. From the task bar, click Start -> Programs -> Accessories -> System Tools -> Scheduled Tasks. You may not have any scheduled tasks defined yet, in which case you’ll see only an icon to add a scheduled task, but don’t click it! I know it’s tempting, but that opens one of those fancy "wizards" and we would rather do things the non-wizard way. Proceed with the following steps:

  1. Right-click on an empty spot in the Scheduled Task window and select New -> Scheduled Task (Also accessible via File -> New -> Scheduled Task)
  2. Name the new task (How about "Bill"? He looks like a Bill, doesn’t he? "Mr. B. Evolution, II" It sounds so regal.)
  3. Double-click the new task to open the properties window (or File -> Properties)
  4. Under the Task tab, enter the same command that you used to test the script above. For instance, enter: C:\PHP\php.exe "C:\Inetpub\wwwroot\blogs\cron\cron_exec.php"
  5. Go to the Schedule tab and enter when and how often the task should run. The schedule defaults to run once daily and should be fine for basic usage, but feel free to tweak as needed.
  6. The rest of the fields can be left as-is, unless you’re an ace and know what you’re doing.
  7. Click OK and we’re done!

Wrapping Up

You’ll probably want to run the task once to make sure everything goes OK. First, change the view of the Scheduled Task window to show all details (View -> Details). Next, right click the task and select Run (or File -> Run…). Watch the Last Run Time column - when it changes from Never to today’s date the task has finished running. Now look in the Last Result column. You should see the code "0x0", which means the task completed successfully. If you see any other code, click Advanced -> View Log in the menu bar and look for any errors reported for your task. Fix any problems and test again until you are successful.

That should do it!

Created by fatimahnasra • Last edit by winskie on 2019-08-19 03:33 • •

No feedback yet

On this page

  • First Things First
  • Hello World
  • Putting It All Together
  • Wrapping Up

Search the Manual

Content Hierarchy

  • b2evolution CMS User Manual
  • User's Guide
  • Installation / Upgrade
    • New Installation
    • Upgrade
    • Configuration files
    • Advanced Setup
      • Test features
      • Intranet installation
      • Intranet setup
      • After Installation / Upgrade
      • Setting up the Scheduler
        • Linux Cron Job Setup
        • cPanel Cron Job Setup
        • Windows Scheduled Task Setup
      • Multi-Domain Setup
      • Multiple instances
      • File Permissions
      • How to change the location of admin.php
      • Google API key
      • GitHub API key
    • Migrating from Another System
    • Moving your b2evolution Site
    • FAQ & Troubleshooting (Installation / Upgrade)
    • Assumed User Skills
  • Front-office Reference
  • Back-office Reference
  • Developer Reference
  • Operations Reference
  • Advanced Topics
  • Glossary
  • Archives
Secure CMS

This online manual is powered by b2evolution CMS – A complete engine for your website.

About b2evolution

  • What is it?
  • Features
  • Getting Started
  • Screenshots
  • Online demo
  • Testimonials
  • Design philosophy
  • Free & open source
  • Terms of service

Downloads

  • Latest releases
  • Skins
  • Plugins
  • Language packs

About us

  • About us
  • Contact

Webhosting Guide

  • Web hosting blog
  • Best web hosting
  • Cheap web hosting
  • Green web hosting
  • Hosting with SSH
  • VPS hosting
  • Dedicated servers
  • Reseller hosting
  • Int'l: UK / France

Docs & Support

  • Online manual
  • Forums
  • Hire a pro !

Other

  • Adsense
  • Press room
  • Privacy policy

Stay in touch

  • GitHub
  • Twitter
  • Facebook
  • LinkedIn
  • News blog
  • RSS feed
  • Atom feed

Founded & Maintained by François Planque