Results 1 to 4 of 4

Thread: Windows Task Scheduler in Windows Server 2008 R2

  1. #1

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,562

    Windows Task Scheduler in Windows Server 2008 R2

    I have nightly tasks scheduled on a Windows Server 2008 R2 machine. The first one kicks off at 5:00 and produces a file. The second one runs at 5:05 and emails me the contents of that file.

    This morning for the first time ever, I received an email containing only yesterday's date. That is usually the first line of text, followed by much more.

    The reason is the 5:00 program wasn't done (it took 10 minutes instead of the usual one minute or less). So the 5:05 program ran and didn't have the input file completely available.

    Is there a way to string together your actions in the task scheduler so that a second program will run when the first program is finished? It seems there are ways to wait for an event to occur, but I don't know how to make the first program produce an event that would get logged and thereby initate the second program. Right now they are scheduled as individual tasks based on clock time. Though it's been fine up to now, I hate having to guess how much time the first program will need.

    The first program is written in VB6 and the second program is written in VBScript.

    Thanks.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  2. #2
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Windows Task Scheduler in Windows Server 2008 R2

    Use a BAT file to launch your exe files one after the other.
    Then schedule this batch file instead of individual exe files.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  3. #3
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Windows Task Scheduler in Windows Server 2008 R2

    e.g. Contents of the .BAT file
    Code:
    start /w program1
    start program2
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  4. #4

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,562

    Re: Windows Task Scheduler in Windows Server 2008 R2

    That makes me wonder why the tasks weren't set up that way from the very beginning. Why would the developer before me have guessed how long it would take to run his first program? He guessed five minutes. Then there's three hours between the second program and the third. I usually think people have a reason for doing things the way they did it originally. Maybe the first program never took 10 minutes in all its past runs. Maybe it never will again.

    Thanks. I'll think about what I want to do.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width