Alternative To Cron - Windows Scheduler

Tuesday, January 8th, 2008

I run a bunch of servers for my business. One , in particular, is better and more advanced than the others. Well, the isn’t more advanced, the installed on it is. On that , I am running Plesk, which I have learned is fantastic.

I recently began automating many of my more boring by using cron jobs. A “ is driven by a , a configuration file that specifies shell commands to run periodically on a given schedule.” Basically, if you have an that needs to run on a schedule and is capable of being triggered by a , 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 with installed on it, setup became very easy. I Just used the “” feature and it was all done.

Well, that’s all fine and dandy for the capable applications on the running , but what about the other servers not running ? I would still have to setup the cronjobs using . 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 …the information I am going to give you below is for . I am sure you will get the gist. Scheduler is a great feature similar to that is installed on your own , not the where your is being hosted, but does something very similar. It automates those boring that you and I would forget about very easily.

So, how do you run a cronjob with Scheduler? If your enabled has a file that needs to be visited (usually something like .php, or something along those lines), it’s quite simple. All you need to do is tell your personal to wake up, open a and visit that page. Here is how you do it:

The first thing you want to do is to open your and click on “System and Maintenance.”

control-panel.gif

Then, on the next page, click “Scheduled .”

scheduled-tasks.gif

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 window open and automatically have it visit a particular .

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 .

task-scheduler.gif

After you click “Create Basic Task,” a window will open with space for you to describe your new task.

create-task.gif

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.

when.gif

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

describe-daily.gif

This screen asks you what action you want to perform. As I said above, I wanted to open a , so I click the “Start a Program” button.

action.gif

Here’s is the trickiest part. On the next screen, you have to choose which program and what additional arguments.

start-program.gif

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 of my file, such as “http://www.mywebsite.com/.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.”

final.gif

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 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 ” 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 was in use and it had no problems. I haven’t tried it when the was in sleep mode, so we’ll see what happens. Give it a shot and let me know your results.

Related posts

Setting Up a Cron Job in Plesk - Part 2

Monday, December 17th, 2007

My cron jobs have been running as scheduled, but the strange part is I have been getting status emails…with errors in them.

I am using the jobs (Scheduled ) in Plesk to run my generators. Every time the generator runs, it deletes the old generated files and creates new ones. I was wondering why I was getting errors. Sometimes, the files wouldn’t generate at all.

I called tech support at my new wonderful hosting company. Melissa explained to me that I set up the jobs under the user account for that domain. When the jobs are run via web interface online, they are running under the user. When they are run by , they are running under a different username, without the same privileges. The run is not able to delete those existing files and write new ones.

The way I got around this in was to click on “” (over in the left column) and then “Scheduled .” Once in the scheduled manager, I clicked on “” to set up the scheduled under that user.

I am running the right now through the …wait…it just finished with no errors and the files were updated correctly. I did not receive a status email because I set the email address up while the was running. I am running a different site right now and will let you know how it goes.

By the way, is very good.

Related posts

Setting Up a Cron Job in Plesk

Thursday, December 13th, 2007

I have been putting this off for a while. For some time, I have had the need to set up a cron job to run my generators. Currently, I do them by hand. Every few days, I log in to each one and run the generator. This gets a little tedious, because I have to do about thirty of them.

I have always known there is a function in the generators that allows a to kick the generators on. All I had to do was set it up. Now, I am not all that good with that little black screen…SSH. I mean, I use PuTTY for some things, but not all that much. I would rather use a nice GUI to take care of these .

Well, it just so happens that Plesk offers that . By the way, I am talking about 8.1 here.

Ok, the first thing I did was to login to . Then, I clicked on, “Domains.” I clicked the domain I was interested in setting up a for. Next, I clicked the “Scheduled ” icon and then the system user. Once I was done clicking all that stuff, I clicked the “Schedule a Task For …” That’s the easy part. Well, the rest is easy too, but at least I was at the place I had to be to set up the job.

Once I was at the task page, there were a few things I had to fill in to set up the job. First, I checked off “enabled.” I think that’s pretty self explanatory.

Basically, I wanted this php script to run every two days at 4AM. It’s pretty simple. For the first field, labeled, “Minute,” I put in a “0.” That will start at zero minutes of the hour. For the “Hour” field, I put in a “4.” This will start the script at the fourth hour of the day. It is based on the 24 hour clock. Ignore the periods after the digits. I put them in there just for grammar’s sake. For the “Day of the Month” field, I put in an “*.” I guess that means any day. I also put in an “*” for the “Month” field. For the “Day of the Week” field, I put in a “*/2.” This means that the script will be initiated every two days. For the last field, “Command,” I put in the path to the file in the script. That is something you will need to get from the script itself.

This was the first time I did this. If there is anything I missed, anything I did wrong or anything that might have been done more efficiently, please let me know by way of comment.

Related posts

About Me

This is my blog. Welcome to it. I write a lot of stuff that doesn't pertain to anything in particular, but you may find a common theme in here somewhere. Enjoy. More

Want to subscribe?

 Subscribe in a reader Or, subscribe via email:
Enter your email address:  
Find entries :