home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
bbs
/
fn132bin
/
fdman
/
chapter.07
< prev
next >
Wrap
Text File
|
1991-09-03
|
6KB
|
152 lines
Chapter 7: Events 93
7 Events
Events are a highly generalised way of making your Fnordadel do things
that it otherwise couldn't, like interface with networks other than
Citadel, run utility programs regularly, et cetera. The mechanism allows
unlimited flexibility with minimal useless baggage; if we had to build all
these neat extra things into Fnordadel itself, it would be the programming
equivalent of Monty Python's ``Mr. Creosote''.
There are three general types of events.
o __Timeout events__ cause Fnordadel to exit to its calling program (a
shell, if you want to do anything useful) at a specified day and time.
The BBS will be polite enough to wait for any current online user to
terminate before exiting.
o __Preemptive events__ are like timeout events except that Fnordadel
won't be the least bit polite; it will immediately boot anybody who is
logged in.
o __Network events__ invoke the built-in networker, to do standard
Citadel networking. Please see Chapter 8 [Networking], page 96, for a
nauseatingly-detailed description of networking. These kind of events
will rudely boot any online user, as with the preemptive type. Note
that during a network event, the system will be effectively closed to
normal user traffic---it will blurt out a terse message if it discovers
that a caller is not a Citadel net node, and drop carrier on him/her.
7.1 Events In General
Events are set up in `ctdlcnfg.sys', as you'd expect. Each event is
defined separately, and the format of the definition is:
#event <type> [days] <time> <duration> <name> <flags>
where the fields mean:
<type> One of `timeout', `preemptive' or `network'.
[days] This is optional. If there, it gives the days that the event
will happen. This field is either `all', meaning that the
event happens every day, or any combination of `Mon', `Tue',
`Wed', `Thu', `Fri', `Sat', or `Sun'---separated by commas. For
example, if you wanted an event for Monday, Wednesday, and
Saturday, you would use a days field of `Mon,Wed,Sat'.
<time> When the event is scheduled to go off (in 24-hour time---e.g.,
3:00pm is `15:00').
<duration>
How long the event is supposed to last, in minutes. If
Fnordadel is brought up after the start of an event but before
the event is supposed to be over, it will immediately do the
event.
Chapter 7: Events 94
<name> A meaningful (to you) name for the event (up to 19 alphanumeric
characters, no spaces.)
<flags> Depends on the type of event. For timeout and preemptive
events, it is the condition code to be returned to the calling
program; remember not to use `0' through `3', as these are
reserved for Fnordadel's own purposes. (See `citadel.man'
for their specific meanings.) For network events, <flags>
represents the number of the specific net to be used. (See
Section 8.1.3.1 [Network events], page 101, for more details.)
Here are a couple of examples:
#event NETWORK all 2:30 30 ld-net 1
This sets up a network event to run every night at 2:30 AM, lasting for
30 minutes. The event is called `ld-net', and will use network #1.
#event TIMEOUT Mon,Wed,Fri 6:00 0 uucp-net 10
This one sets up a timeout event for 6:00 AM on Mondays, Wednesdays and
Fridays. The event is called `uucp-net', and exits to the shell with code
10. (The shell, presumably, knows what to do when it gets a 10 back---see
Section 11.2 [Running from a Shell], page 145.) Since the event is a
timeout and not preemptive, if a user is logged in at 6:00, the system will
wait until he/she terminates before exiting to the shell.
You may have any number of events defined in `ctdlcnfg.sys', though
there are some practical limits---too many events and your system won't be
up long enough for a user to sign on.
7.2 Some Notes on Events
o See Chapter 11 [Shells vs. the Desktop], page 143, for some
ideas of what to use all this event stuff for. But we'll tell
you now: If you're running from the desktop, you can't really use
timeout/preemptive events, because the desktop has no mechanism for
dealing with codes returned by programs.
o If you set up a timeout event, followed soon after by a preemptive
event, and a user logs stays logged in through the duration of the
timeout and into the preemptive, silly things will probably happen.
o If the event is a timeout or preemptive event, you'd probably want
to use a <duration> of `0', to prevent the situation where Fnordadel
exits, the shell does whatever it does, the shell finishes, and then
reruns Fnordadel, all before <duration> has expired---Fnordadel would
then exit all over again.
o An event causes Fnordadel to exit completely; this is different from a
door, which causes Fnordadel to act as a shell and run another program,
while still remaining in memory. See Chapter 9 [Doors], page 126, for
information on doors.
Chapter 7: Events 95
7.3 Timeouts
An additional form of event is the specialised variable timeout. (This
should not be confused with an #event of type #timeout.) If you have the
variable #timeout defined as `1' in `ctdlcnfg.sys', Fnordadel will look for
another variable called #hourout. The system will set up a timeout event
for #hourout hours after the system comes up, and will exit to the shell
with a condition code of `1'. Here's an example:
#define timeout 1
#define hourout 8
This will, in effect, cause Fnordadel to take itself down every 8 hours
(because the counter is reset every time the is brought up.) This feature
is designed for doing things like regular backups controlled by a shell
script.