This Windows NT service has been written to complete (or enterly replace!) the "Planning" service provided by Microsoft with programming with "AT" command (in a DOS window). META-Schedule has the following advantages :
cron
).WEBSERVER
added to check activity.
The installation can be made through the normal programs like SC.EXE
(available in the NT Ressource Kit of Microsoft) or, much easier, by the program MSchedule.exe
itself.
To install the scheduler, make a directory, copy the file and type: mschedule
--install
in a DOS window. In the same directory, you must write the configuration
file mschedule.ini
wich includes the commands to schedule.
To install more than a instance of the program, type: mschedule --install
<file>
where <file>
is the configuration file <file>.ini
wich must be in the same directory than the file mschedule.exe
.
Note: Configuration files must be in the same directory than the main program (not in the Windows directory!).
Like a "AT" command, this command launch external programs. If it is a
internal command (DEL, TYPE...), use the command interpreter (CMD
).
You can specify a maximum time to run, after this time, the external program will be
automatically destroyed.
External commands enables environnement variables extension. The use of %windir%
will be replaced by the Windows directory (C:\WINNT
by default).
[Backup] CMD=Extern Program=PKZIP25 -add %windir%\*.* D:\win_nt.zip AT=10 1 * * 1-5 Priority=Normal
Specified priority is intended to the external program, i.e. the priority of the new program will be set by the scheduler himself.
Checks the available space disk. A mail is send if the space is lower than the
specified quotas. You can check network drives if the user specified for the service has
the corrects rights.
Note: if you activate the quotas on Windows 2000, the free space returned can be false.
[SpaceOnDisk] CMD=DiskFree C:\=50M D:\=300K AT=0 * * * *
This example checks the free disk space every hour on the C: drive (must remain 50Mb) and
D:\ (must be remain more than 300Ko).
One of the most interesting option is the scheduling of NT services. The test is automatically made at the start of the service, and a service can be maintened running at special hours. Arguments are the following:
Name
: service name.argx
: arguments needed by the service (arg1
, arg2
,...).
This parameter is generally not used.PhysicalCheck
: when the service is run or stopped (at the start of the
scheduler), the scheduling program can checks if the service is still running or not. In
the case of PhysicalCheck
is to TRUE
, if the real state is not
the good, the service is forced in the correct mode (this can be a problem when you make
work on this service manually, this can be interesting if the service MUST run in all
cases, even problems).[WebServer] CMD=Service NAME=W3Svc PhysicalCheck=TRUE AT=* * * * *
This example above shows how to force the IIS4 server to run everytime. If somebody stops it for any reason, it will restart in the next seconds.
This commands checks a file and if the file exists, the scheduler transfers it by mail
and then delete it.
If no file is specified (item File
), it's the Dr WATSON (drwtsn32.log
in the Windows directory) wich is taken. This command permits to checks when a program
crashes.
[COREDUMP] CMD=ErrorFile AT=* * * * *
or:
[ERROR_TOTO] CMD=ErrorFile File=%windir%\toto.err AT=* * * * *
This command makes a file copy. The source file can be on the machine or on a network
driver or on a distant server (HTTP, HTTPS ou FTP).
If the file has a .gz
, it will be uncompressed automatically if it is the
source or compressed if it is the destination. It's important to note that the file is
putted in memory before copied on the local disk.
This function is specially used to optimize dynamic HTML pages in a static version.
Note: the source file and the destination can use expanded variables.
[PAGE_GARDE] CMD=COPY Source=http://www.videotruc.com/ Dest=c:\inetpub\wwwroot\index_video.htm AT=1 * * * *
Enables a WEB server to check performances. In new versions, it will be possible
to configure on-line.
[Informations] CMD=WebServer Port=8088 AT=* * * * *
This example enables the WEBSERVER 24/7. Use a browser to known how many time is spent in programs (in CPU times and real times).
Not very useful. The following example tries to reboot your machine at 0h00 the first day of the new year! This command is available for tests purpose only.
[Security]
CMD=REBOOT
AT=0 0 1 1 *
This command permit to synchronize the local clock with NTP servers. If no server is
specified, the scheduler will use a predefined list.
For maximal security, the time synchronization will NOT be done if your server has a
difference of less than 2 seconds with the NTP server. Same way, if the synchronization is
more than an hour, no synchronization will be done. To optimize the security, the
scheduler will use 3 servers to synchronize (in the case of a server is not correctly
set). It is not a good idea to set only one or two servers, but in this case, the
synchronization is more random.
I give your this tip: synchronize your machine at 5 or 6 hour in the night (not at
midnight!).
[TimeSync] CMD=TimeSync truechimer.waikato.ac.nz= ntp1.arnes.si= vtserf.cc.vt.edu= AT=10 5 * * *
Note: This command is only available in the registred version.
Expansion of variables (for the external programs) will follow the rules noted below. If the variable is an environment variable, the variable is expanded, if not, the following variables are always availables:
DATE
: system date in the format YYYYMMDD.TIME
: hour in the format HHMM.HOUR
: hour in the format HH (from 00 to 23).MINUTE
: minute in the format MM (from 00 to 59).YEAR
: year in the format AAAA (with the century).MONTH
: month from 01 to 12.DAY
: day in the month (from 00 to 31).Notes:
Example: %WINDIR%\system32\toto.txt will be extended to "c:\winnt\system32\toto.txt".
The scheduling service is multi-threaded. Every command is run in a separate thread (with a different priority for each).
The internal clock is used as reference at the start of the program, but, to support a
modification of the time, a virtual clock is used in the scheduler to be always
synchronized and not forget some commands.
Example: if a command is scheduled every day at 5h30. A system administrator système
modify the time from 05h25 to 5h32, the command will be correctly scheduled.
The [Config]
section specifies specific options to the scheduler. Some of
them are by default.:
_last
: this information is written (if possible) by the
service himself. It's the last scheduling made by the program (in the ISO Date format).WriteHour
: if this option is active (=TRUE
),
the time used at the start of the service is not the system time, but the last time of
scheduling (stored in _last
). This permits to fill the gap of time between
two reboots or the time between the stop of the scheduling service and its new starts. MailTo
: specifies the mail adress for mails. This
information can be changed for every command. Note that the scheduler uses the MAPI
protocol to send messages (not a direct SMTP protocol).SMTP
: if you specify a SMTP server, mails will be sent
by direct TCP connection rather than MAPI32. This is more efficient. In this case, you
must sepcify From
to specify the name of the sender.
From
: Used only for SMTP connections. You put your mail
address (ex: William Rey <willsoft@free.fr>
).
Trace
: file to trace all operations made by the scheduler.
You can use the following extensions: %d
for the date in the form YYYYMMDD
.
The extension .htm
ou .html
provides HTML logs (rather
than text). Exemple: | [CONFIG] TRACE=C:\LOGS\SHED-%d.log |
will gernerate logs in the directory c:\logs
, one file per day. SHED-20010508.log
will be for the May, 8th of 2001.
MailTime
: Number of seconds between two mails on the same
command. 20 minutes by default. If a command generate an error (an then a mail) at 12H30,
the next mail will not be send before 12H40. This is a security to not complete your mail
box .WaitForDone
: Not documented. Value set by default.RoundBeforeStop
: Number of maximum wiats for the end of
the running of an external program when service tries to stop. Fixed to 8 by default. WaitAfter
: waiting time (in
seconds) before starting a new command. This value avoids intensive use of CPU when news
threads are created in the same time when more than one command start at the same time.
Fixed to 0.77 seconds by default. WaitAfterOnStart
: Same as WaitAfter
but concerning the start of the scheduling (for services and starts of programs at start
time). Fixed by default to 1.8 seconds.Wait
: time (in seconds) to sleep the main thread. By
default 17 secondes. This value must be between 1 and 55. License
& Serial
:
license and serial number for the complete version. You can check the correct values in
the first lines of the log file.For each command sections, the following items can be used:
AT
: To determine the time of launch for the command. Same
as the syntax used in crontab files under Unix.* * * * *
: 24/7 every minutes (or continue for NT services). * * * * 1-5
: from monday to friday every time. stopped in the
week-end. 0 * * * *
: 1 time by hour. 12 1 * * 1-5
: 1 time by day at 1h12 in the morning, every day from
monday to friday only.4 0 1 * *
: All the first of each monthes (at 0h04).* * * 1-3 0
: Sundays, every time from january to march (very special
command, isn't it?).Start
: Hour to start (format is HH:MM). Replace an AT
item.End
: Hour to stop (format is HH:MM). If stop time is
before the start time, command is runned through the night Replace an AT item.Every
: If the command is not to run every minutes, specify
another interval (in minutes). Replace a AT item. Ignored for NT services.Priority
: Specify la priority for the command: IDLE
: commande is run only when CPU is not used. VERYLOW
: minimal priority.LOW
: low priority.NORMAL
: normal priority (same as the others programes). By default. HIGH
: high priority.VERYHIGH
: very hight priority.REALTIME
: real-time (not safe).MaxProcess
: maximal number of de processes for a same
command. Can launch the same command more than one time. By default, the command can not
launch more than one time.OnStart
: put "TRUE" if you want lauch the
command at the start of the scheduler (in all cases). MailTo
: mail adress for warnings and errors. By default,
the mail adress in the [Config] section is used.TimeOut
: Maximal time for a external command. By default,
there is no time-out for running a program.The following things will be done:
You can send me ideas and priorities at my adress: winnix@club-internet.fr
The service described above is limited if you are not registred. The Freeware licence limits are:
All questions must be sent to my adress: winnix@mindless.com. Thanks a lot.