Consultor Eletrônico



Kbase 18224: Windows NT Scheduler (cron)
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/06/1999
Windows NT Scheduler (cron)

Windows NT has a scheduler function called AT that is loosely similar
to the cron command in UNIX. The syntax for AT is a bit simpler,
such as:

AT 03.00 /EVERY:TUESDAY "insert any NT command here"


The above command will be executed every Tuesday at 3:00 AM. This is
useful for shutting down databases, performing backups, starting
databases or other system administration chores. The command can be
almost any NT command or BATch file.

For more information on the AT command, open a DOS windows and type:

AT /?

The AT command is a character mode program. A GUI version called
WinAT is available on the CD-ROM included in the Microsoft Windows
NT Resource Kit. For details on WinAT, load the program and then
then click on HELP to view the documentation.

Many Progress customers have had problems making the AT
command work properly. The Windows documentation does not provide
in-depth explanation of the command. Microsoft does provide an
excellent document on their Web site called "Troubleshooting AT
Command Using /k Switch." To read this document, go to
http://www.microsoft.com and search for document Q142040.

The AT and WinAT commands will only operate if the Windows NT
Schedule Service has been started. Go to START -> Control Panel ->
Services -> Schedule. Most system administrators prefer to set the
Schedule Service to start automatically when the system is booted.

Next, remember that all jobs run under AT and WinAT will default to
running as a SERVICE, not as a user. A Windows NT service can access
files and processes on the local machine but cannot directly access
other processes or files on other systems on the network. It also
does not understand mapped drive letters as those are available only
to users. The following command using a mapped drive S: will fail:

AT 03.00 /EVERY:TUESDAY COPY \DLC\*.* S:\BACKUPS
The above command will fail because the normal default of Windows NT
services cannot use the mapped drive "S:". One method around that is
to run the job as a User, not as a system service. This can be done
via Start -> Settings ->Control Panel -> Services -> Schedule and
then click on Startup. You may select "Log On As This Account" and
then fill in the user ID and password. Note that all Schedule
activities will run under this account. Microsoft did not provide
a method to mix and match system services with user account jobs.

If the scheduled job involves network access, a batch job needs to
be used that includes a network mapping command such as:

NET USE S: \\SERVER-NAME\SHARE-NAME
COPY C:\DLC\*.* S:\ <-- or any other valid Windows NT commands
NET USE S: /DELETE

The last line un-maps the S: drive. If this is not done, the S:
drive will be "in limbo" after the scheduled job is finished. No one
will be able to map a Drive S: again until the system is re-booted.

(If you are using Novell IntraNetWare clients see the note at the
end of this document.)

As mentioned in Microsoft's document Q142040 a useful method of
debugging batch files to be used by the AT or WinAT commands is to
use the command:

AT &lt;xx.xx&gt; /interactive cmd.exe /k

This allows for troubleshooting "live" with all commands and error
messages (if any) displayed on the screen. See Microsoft document
Q142040 for the details.

The /interactive switch mentioned in that document only works if
the Scheduler is run as an NT service, it will not function if
the Scheduler is started as a user job. (Microsoft only makes a brief
reference to that in document Q142040.)

The Microsoft AT and WinAT commands can be very useful but they are
primitive and do not have a lot of flexibility. Several companies
have developed more powerful scheduling programs with a wide
variety of features. A number of shareware programs can be
downloaded online from:

http://www.winfiles.com/apps
t/auto.html


Disclaimer: Progress Software Corporation has not tested any of
the programs available at that Web site. If you have questions about
the use of any of them, please contact the Tech Support department
of the company that produced the scheduling program.

Note for Novell IntraNetWare users: Novell had a bug in their client
software when used with Windows NT Scheduler. The following is a
quote from Novell: "Symptom: TID 2931791 - Accessing a drive letter
created by NET USE with NT Scheduler service did not work properly
when the IntranetWare NT v4.11 client is installed."

Novell issued NT411P1.EXE IntraNetWare NT Client Update on 4 Sept. 98
to correct this bug and many other technical issues. Full details are
on Novell's web site. Search for: NT411P1.EXE

18224 Updated 16-Sep-98
reastman