Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Playing with Windows task scheduling in perl. 1

Status
Not open for further replies.

lakshmi1980

Programmer
Oct 2, 2006
2
0
0
US
I would like to capture the result of windows task scheduling in perl.Basically I will be scheduling a perl job to do some task in windows scheduler in a particular day of a month.It will start 1.15AM morning to perform that task.If the task is successful,we have to capture that and we have to do some FTP of a file to a UNIX box from there we will do another task.If the task is not sucessful it has start after 2 hours for example it has to start executing the program by 3.15AM until it is successful for the whole day.
If the task is successful the scheduler has to stop executing the task.We will do the schedule which will execute the task from 1.15AM in the morning in the day and will execute for every 2 hours for the whole day.Our work is to capture the result of the scheduling and if the job is successful we have to stop the schedular to perform that task.

I created the perl job to execute our job,FTP stuff,Scheduling in Windows and task after FTP of file in UNIX box.The only thing pending is to stop execution of the job after it is successful.

Could able please able to help me out in this??Is there any module in perl useful to play around with windows task scheduling??
 
An easy way to accomplish what you're looking for would be to have the ftp script write to a text file either a successful or unsuccessful status value (1 or 0, true or false, completed or failed, etc.)

Set a windows task to run every two hours. When the script starts up, check the text file to see if one of the previous runs was successful, it it was, exit the script, if it wasn't, try to ftp the files again. If the ftp portion of the script ran, write the status of the transfer to the text file.

You'll also have to make another option/script so that at about 01:00, it either deletes the file or sets the status to the unsuccessful value so the ftp portion of the script will run again.
 
Thanks for your reply rharsh.

I think you are telling what i have to do in UNIX machine after FTP of the file.I will be doing that in my unix machine.Basically we are having all the jobs scheduled in CONTROL-M schedular in UNIX machine.

So to get this Windows NT job scheduling into Control-M framework we are FTPing a file that will watched by a filewatcher job in CONTROL-M.

Once the file is FTPed after succesful execution of the job,the filewatcher will identify the file and control-M job which watches the file will be successful.

My concern is to stop the job after it's successful execution in windows task scheduling.I don't know how to stop the job execution after successful completion since in Windows task scheduling we dont have provision stop the job based on it's last result.My basic requirement is the NT job has to run again and again if it is not successful and if it is successful it should stop running.
My understanding is if we have provision to do the windows task scheduling using perl programming instead of doing it using GUI based windows stuff we can control the jobs execution irrespective of it's scheduling cycle.
 
I'm still a bit confused, but take a look at Win32::TaskScheduler - that should do what you want.

Also, there should be a way to access the task scheduler from the command line. In XP, it's schtasks - it might be called the same thing in NT - although it could very well be part of the ResKit, I can't remember.
 
In NT, 'at' IIRC

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top