Technique #1. The Preferred technique:
# Schedule job to run every day except Saturday and Sunday,
# between the hours of 8:00 AM and 5:00 PM
{
# Name our job
-name my job
# Start now!
-start
# Skip Saturday and Sunday
-skip –week 7,1
# Suspend all processing before 8:00 AM
# (Start suspending at 12:00 AM and resume at 8:00 AM)
-suspend -time 12:00:00 AM
-resume -time 8:00:00 AM
# Suspend all processing after 5:00 PM
# This suspension will run until the 24 hour clock
# rolls-over at 12:00 AM
-suspend -time 5:00:00 PM
# if it is between 8am and 5pm, do our job.
# Print Hello World!
# (Or do whatever real work you wish)
-action -print "Hello World!"
# Increment the day field.
# This will cause the job to fire tomorrow at the same time
-action -inc 1 0 0 0
}
Technique #2.:
Note: These two scripts work together.
# Loader script. This script loads the 'worker' script at 6PM
# We will do this every day
{
-start -time 6:00:00 PM
# load and run the worker script
-action -load c:\scripts\myscript.tab
# do this again tomorrow
-action -inc 1 0 0 0
}
# Worker script - myscript.tab
# Run every 10 minutes between 7PM and 7AM
{
# start at 7PM
-start -time 7:00:00 PM
# kill job at 7AM (constrain to keep from stopping now!)
-stop -time 7:00:00 AM -constrain 0 0 5 0
# do stuff
-command Defrag /s /f
# schedule again in 10 minutes
-action -inc 0 0 10 0
}
_________________________
Regards,
Luke Tomasello