====== Events ====== An event is simply a batch file that gets executed during a specific time of the day. In this event batch file you can do some of the following things: - Pack your users and/or message bases - If you are part of a mail network, you will most likely transfer mail packets - Some third party products you use on your bulletin board may need to run utilities to update databases, etc. - Create a list of files on your system using PCBFiler and the /LIST parameter. - Backup your system The previous examples are but only a few of the things you can do in your event. Since events execute batch files, you are more or less limited by your imagination as far as what you want to run in your event. ===== Adding An Event ===== To define the events on your system, you need to go to PCBSetup | Event Setup. Next, you need to make sure that you have answered Y to the Is a Timed Event Active question. Finally, if you cursor down to the EVENT.DAT line and press F2 you will a screen that resembles the following: The number to the left of each line is the event number that is being defined. The rest of the fields on the screen are as follows: |**Act**|You may enter either a Y or an N in this field. A Y signifies that the event is active and should be executed as configured. If you enter an N then the event will be considered inactive and will not be run as defined.| |**Mod**|The mode of the event. You may enter either an E or an S in this field. If you enter an E, the event is a "rigid" or non-sliding event. If you enter an S as the event type, the event is referred to as a sliding event. If an event is an expedited or non-sliding event, PCBoard will make its best attempt to execute the event at the time you specify as the beginning time even if it means cutting users time short.| |**Batch File**|In this field, specify the batch file you wish to execute for the event you are defining. Note that you are only given 8 characters for the batch filename. The reason for this is that by default this batch file will be run on all nodes. However, you can make node specific batch files by making the node number the filename extension. For example, if you entered a batch file of DAILY and you want node 5 to execute a different batch file, create a DAILY.005 file in the same directory where the DAILY file is located.| |**Begin Time**|In this field, enter the earliest time that you want your event to run. The time you enter in this field must be in 24 hour format and there must be a colon between the hour and minutes.| |**End Time**|The end time is the latest possible time you wish for the event to run. If the event has not run by the time you enter, the event will be skipped.| |**Days**|You may also control which days the event you are defining is run on. In this field all seven days of the week are listed beginning with Sunday and ending with Saturday. Simply enter either a Y or N which signifies whether you want to run the event on the day listed or not.| |**Date**|This field enables you to specify the dates PCBoard will run the event. For example, if you want the event to run on the first day of every month, enter a date of 00-01-00. Entering a 00 signifies a wildcard. Using the previous example, this means it would run for any month, and any year, but only when the day of the month is equal to 01. Another example would be to set the date to 07-04-00. This means the event would run every July 4th, no matter what the year is.| |**Last Date**|Contains the date the event was last run on the node number specified in PCBSetup > Node Configuration. Not all events run system- wide - therefore, this field only contains the last date ran for the node you are currently editing.| As an example, let's say you want to have an event that runs at 3:00am every morning and packs your message bases. The first step would be to edit your EVENT.DAT file in PCBSetup > Event Setup. First, place Y in the Act column, because this is an active event and you do want it to run. Next, place an S in the Mod column because you would like for this event to run at 3:00am but you would not mind waiting for a caller to logoff before running the event. Next, you need to enter a batch filename. For lack of a better name you can enter PACKMSGS as the batch filename. Now you must enter the earliest time that you wish for the event to run. As outlined earlier, you want this event to begin at 3:00am so you would enter 03:00 in this column. If the latest that you want the event to run is 08:00am, you would need to enter 08:00 in the End Time column. Finally, you need to specify the date and days that the event will run. If you leave the Date column blank or filled with 00-00-00 it will run for every day of the week that you specify in the Days columns. Because the event will pack the message bases, you probably want it to run every day of the week so put a Y in every day of the Days column. Once you have done this you will have an entry which looks like the following: Batch Begin End Last Act Mod File Time Time SMTWTFS Date Date --- --- -------- ----- ----- -------- -------- ------- 1) Y S PACKMSGS 03:00 08:00 YYYYYYY 00-00-00 00-00-00 Next, you need to create the actual batch file that will execute your event. In actuality, this is very easy to do. Simply highlight the batch file field you want to edit and press F2. Your default text editor defined in System Manager | Define Text & Graphics Editors will be used to edit the batch file. For example, your batch file might look like this: PCBPACK /AREA:ALL /MAXMSGS:1024 /PURGE BOARD This batch file simply runs PCBPack on all message bases. Once the message bases have been packed, BOARD.BAT is reloaded which will make the system once again available for callers. By default this event will run on every node of the system. Obviously this would not be a good idea to have every node packing the message base at the same time. What you should do is rename your batch file to make it a node specific event batch file. For example, to make this batch file run on node 3 only, rename the batch file from PACKMSGS to PACKMSGS.003. Adding the .003 to the end of the filename, tells PCBoard it is a node specific file and only node 3 should run the event. ===== Multiple Nodes ===== Frequently you will need more than one node to participate in an event. Whether you want each node to perform a particular task, or if you need all nodes to be down, it is important to understand how to control your events. ==== Node Specific Events ==== Most likely you do not want all of your nodes to run the event batch file. You may have one node that does all of the work while the others wait or do other tasks. In the EVENT.DAT file, specify the base event batch filename. This is the batch file that will be executed for all nodes unless there is a node specific event batch file. To create a node specific event batch file, create a file with the batch filename and an extension of the node number. For example, if your event batch file is called MAINT1 and if you want to make a batch file that only node 6 will execute, create a batch file called MAINT1.006. When event time rolls around, all of the nodes except node 6 will run the event using the MAINT1 file. Of course, node 6 will use the MAINT1.006 file. If you wanted only node 6 to run the event and the other nodes to not even both going down for the event, create the MAINT1.006 file and then delete the MAIN1 file. Since the other nodes would not have a batch file to execute, they will not execute the event. ==== Making Sure All Nodes Are Down ==== To perform global changes to the system such as sorting the user file, or doing a total backup of your system, you will need all of your nodes to be down. Perhaps the easiest way to accomplish this is to have your nodes simply run a program as they begin the event that will count for a certain amount of minutes or seconds while the event is running. When the nodes are down counting, they can then reload the board. As an example, let's assume that you are operating a three node system. You want node 1 to sort the users file. In order to do this, nodes 2, and 3 must not be operating. Quite simply, you create a node specific event file for node 1. If your event batch file is called USRSORT then you would create an event file called USRSORT.001. This batch file might look like the following: @ECHO OFF PCBSM /SORT;SECURITY;PRIREVERSE BOARD In your testing, you have found out that it takes about 4 minutes to complete the sorting process. Therefore, you need to make sure that the other nodes stay down for a bare minimum of 4 minutes. Just to be safe, you could even keep them down for 10 minutes or so because the time it takes to sort the file will increase as the number of users on your system increases. You should be able to find several utilities will count for seconds or minutes on the PCBoard Support BBS. For example, if you found one called Count which counts for the number of seconds specified, make your USRSORT batch file look like the following: @ECHO OFF COUNT 480 BOARD Quite simply, this would make nodes 2 and 3 (because a USRSORT.002 or USRSORT.003 file was not found) count for 480 seconds and then reload the bulletin board. This should give more than ample time for the sort process to be completed. There are several other methods you can use to make sure all events are down and stay down. Most of these have been addressed by third party authors and are available on the PCBoard Support BBS by using the Z user command and searching for EVENT.