WinCron 1.51 INTRODUCTION: WinCron is basically a Windows implementation of the UNIX cron program. WinCron runs under Windows 95 & Windows NT. The main advantage this program has over many of the event scheduling programs already out there (besides being free) is that it can read the event table as a text file from any drive. This allows you to alter the events that are being scheduled without having to have access to the console of the computer that WinCron is running on. Editing the text file can be done from any machine that has sufficient rights to alter the file. INSTRUCTIONS FOR USE: WinCron was written in Visual Basic 4.0 (32 bit version) and requires standard VB libraries (VB40032.dll). The event (crontab) file is limited to 1000 lines. If you should need more then that, a second instance of WinCron can be launched and a different event file can be specified for the second instance. WinCron uses the same convention as many UNIX crontab files, a plain text file with each line having six fields separated by one or more spaces. The fields are as follows: 1. Minute 2. Hour 3. Day of Month 4. Month 5. Day of week (0 being Sunday), 6. The instruction you wish to execute. Example entry: 01 01 01 * * c:\batch\cleanup.bat This line would start the "cleanup.bat" batch file at 00:01 (12:01am) on the first day of every month, regardless of the day of the week. It is also acceptable to schedule multiple times for a program to run by separating entries with a comma. If this is done, you MUST use two digits for each entry in the "Minute", "Hour", and "Day of Month fields". In the "Day of Week" field, each entry MUST be a single digit. There cannot be any spaces between the comma separated entries. Example: 01,02,03 01 01 * 1,2,3,4,5 c:\batch\cleanup.bat Because Windows 95 and Windows NT have slightly different ways of initiating an asynchronous process, it is recommend that you place the commands to be run in a batch file and use WinCron to start the batch file. This will allow you to set any parameters or handle any decision making logic outside of the WinCron program. If you don't do this, you are likely to receive an Error 53, "File not Found", if you try to pass command line parameters to the executable you wish to run. Using batch files also allows you to use MS-DOS shell switches to control how the program being launched is handled. Windows .pif (shortcut) files can also be used to control how the batch file is run. Because this software is often run on servers, I have attempted to leave most program control functionality to the shell in the interest of stability. Starting a line with # will cause that line to be ignored, so remarks may be placed in the event (crontab) file. The # must appear as the first character of the line and must be followed by at least one space. Remark lines count against the 1000 line maximum of the event file. To start WinCron, simply launch it from the command line or from a short cut. The path and file name of the crontab file MUST be specified at the command line ( i.e. WinCron f:\system\util\crontab.txt ). THERE MAY BE A DELAY OF UP TO 55 SECONDS BEFORE THE PROGRAM LAUNCHES. This is to allow the timer to be set so it is not near a change of minute which might result in unpredictable behavior on highly loaded systems. The only purpose of the large button in the middle of the main form is to check if the program is still responding. Pressing this button updates the button's caption to indicate current status and time. Double Clicking on the text box that shows the crontab file being used launches Microsoft Notepad (if it is in the system path) to edit the file. The program reloads the event table every 60 seconds. The switch /NoUpdate can be used to prevent WinCron from updating the crontab file. If this switch is used, WinCron will only load the crontab file once when first launched. Example: WinCron f:\system\util\crontab.txt /NoUpdate There is also a /Hide switch that has been added at the request of several sysadmins. This will prevent the user from being able to see that WinCron is running; however, this means the only way for the sysadmin to check on the program is to hit crtl-alt-del and look at the task list. Example: WinCron f:\system\util\crontab.txt /NoUpdate /Hide Logging can be enabled by using the /Log switch at the command line. WinCron only logs errors and program launches. If the exit status of a program is needed, then the batch file used to the launch the program must be used to record this information. The log file is always named the same as the crontab file with an extension of .log appended to the end. That means if you name your crontab file "crontab.txt", the log file will be named "crontab.txt.log" This has been known to cause problems on systems where the crontab files is being stored on a network drive that does not support long file names. If you run into this problem, my suggestion is to simply call the crontab file "crontab" with no extension, so that appending .log will result in a log file named "crontab.log". Example: WinCron f:\system\util\crontab.txt /NoUpdate /Hide /Log There has been some debate as to how to handle errors in a cron type program. The default action is for WinCron is to simply fail and exit on any error. The reason for this is that often cron programs are used to schedule several events in a specific sequence. A lost network connection or similar event could cause unpredictable results. The safest way to handle errors seems to be halting all events until the situation can be evaluated. If you would prefer WinCron to continue to process events after errors, the /ContinueOnError switch may be used. Note: the program will still fail and exit if logging is switched on and the log file becomes inaccessible. Also remember, multiple instances of WinCron can be launched on the same computer. Each instance can be launched with different switches, so a table containing events that must be run in sequence and one containing unsequenced events can both dealt with in different modes on the same machine. Example: WinCron f:\system\util\crontab.txt /NoUpdate /Hide /Log /ContinueOnError I hope that this program is useful to you. I can make no claim as to this software's stability or value. It is being offered as is. Use at your own risk. If you find it useful, all I ask is that you please email me at wc@ix.netcom.com just so I know that it's useful to someone. All copyrights are reserved by the Author; however, there are no restrictions on commercial use of this program. Also, feel free to email any suggestions for revisions to the program.