Alternative To Cron - Windows Scheduler
January 8, 2008 – 12:41 pm | by jaygaulardcom
|
|
I run a bunch of servers for my business. One server, in particular, is better and more advanced than the others. Well, the server isn’t more advanced, the software installed on it is. On that server, I am running Plesk, which I have learned is fantastic.
I recently began automating many of my more boring tasks by using cron jobs. A “cron is driven by a crontab, a configuration file that specifies shell commands to run periodically on a given schedule.” Basically, if you have an application that needs to run on a schedule and is capable of being triggered by a cron job, using this feature can be a real time saver.
One of the reasons I didn’t start using this nice little feature sooner is because I had no idea how to set it up through SSH. When I got the new server with Plesk installed on it, setup became very easy. I Just used the “Scheduled Task” feature and it was all done.
Well, that’s all fine and dandy for the capable applications on the server running Plesk, but what about the other servers not running Plesk? I would still have to setup the cronjobs using SSH. Believe it or not, I have been avoiding setting up those jobs to this day. Just a bit of background…these jobs only need to run every few days or so. What I am about to suggest is not really suitable for jobs that need to run every few minutes.
Last night, I started fooling around with “Windows Scheduler.” The link I just gave you is for XP…the information I am going to give you below is for Vista. I am sure you will get the gist. Windows Scheduler is a great feature similar to cron that is installed on your own computer, not the server where your website is being hosted, but does something very similar. It automates those boring tasks that you and I would forget about very easily.
So, how do you run a cronjob with Windows Scheduler? If your cron enabled application has a file that needs to be visited (usually something like cron.php, or something along those lines), it’s quite simple. All you need to do is tell your personal computer to wake up, open a browser and visit that page. Here is how you do it:
The first thing you want to do is to open your control panel and click on “System and Maintenance.”
Then, on the next page, click “Scheduled Tasks.”
After you click that, you will be brought to the Task Scheduler screen. It’s a new window. I am going to go over how I set up a new task this morning. As I said above, all I wanted to do was to have a browser window open and automatically have it visit a particular URL.
The first thing I did was to click on the “Task Scheduler Library” and then on “Create Basic Task.” The Task Scheduler Library is where I am going to store these tasks.
After you click “Create Basic Task,” a window will open with space for you to describe your new task.
Fill in the information so it’s recognizable to you. Then, click next (down at the bottom). The next window is going to ask you when you want your task to run.
I set it to “Daily.” On the next screen, you can adjust it.
On this screen, you can describe more about your daily task, such as start date, time and frequency. I set mine to every other day (a 2 in the recur every: box).
This screen asks you what action you want to perform. As I said above, I wanted to open a browser, so I click the “Start a Program” button.
Here’s is the trickiest part. On the next screen, you have to choose which program and what additional arguments.
In the “Program/script” box, I browsed to open Firefox, which in this case gave me this path, “C:\Program Files\Mozilla Firefox\firefox.exe.” In the “Add Arguments” box, I put the URL of my cron file, such as “http://www.mywebsite.com/cron.php.”
In the final screen, you are offered a summary of what you filled in. I like the check off the “Open properties” box for some extra steps I needed to take. Click “Finish.”
The last few items are quite simple, so I won’t offer screen shots for them. When the Properties box opens up, click the “Conditions” tab up top. Since my computer goes into sleep mode after a half hour of non use, I want to wake it up to preform the task, so I click the “Wake computer” check box. Then, I click the “Settings” tab up top. In case the task is missed for some reason, I click the “Run task as soon as possible…” check box and the “If the task fails, restart every:” check box. You can put your own values in there.
When you are finished, hit “OK” and see how it goes. I tried this with a specific time when the computer was in use and it had no problems. I haven’t tried it when the computer was in sleep mode, so we’ll see what happens. Give it a shot and let me know your results.
Related posts
Tags: application, browser, computer, control panel, cron, cron job, crontab, plesk, server, sleep more, Software, ssh, tasks, url, vista, windows, xp



























