How to start a script at a specific time of day?

I've been using WAIT as a simple timer to start my scripts in the middle of the night. Is there any other way to start the scripts say at 1AM each morning? Thanks

Comments

  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    To start a script at some future time, we generally suggest using a utility such as cron or the 'at' command to run scripts from the command line.

    For Eggplant Starter Edition (Green) users, the command line isn't an option, so you'll need to do something like what you're doing now. One thing that may be helpful is to write a generic starter script. For example, if you frequently want to start scripts at 1:00 AM the following morning, you can use the fact that the date function returns a time of noon today to calculate how long to wait like this:
    //runScriptAt1AM.script
    params scriptToRun
    put the date + 1 day into tomorrowNoon
    put tomorrowNoon - 11 hours into tomorrow1am
    put tomorrow1am - the time into timeToWait
    wait timeToWait
    run scriptToRun
    
    Then you could just call it like this:
    runScriptAt1AM "test23.script"
    
    Hopefully that helps simplify things a bit.
Sign In or Register to comment.