home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / bbs / citadel2 / bat_hint.doc < prev    next >
Text File  |  1989-12-01  |  4KB  |  95 lines

  1. /************************************************************************/
  2. /*                Bat-Hint.doc                */
  3. /************************************************************************/
  4.  
  5.    No program is ever bug-free.  However, it is nice to pretend that one
  6. is, and an effective way to pretend that a particular program has achieved
  7. such a goal is by never having it require your attention when you are
  8. attending to other things.
  9.  
  10.    Citadel-68 tries to emulate this sort of software by returning a value
  11. to GEMDOS when it terminates gracefully.  There are 4 possible values
  12. returned by Citadel-68 that can be read by a GEMDOS batch file (provided,
  13. of course, that you are using a batch processor that can handle it.):
  14.  
  15. 0 -- indicates that the sysop requested that the program terminate.
  16. 1 -- indicates that the system terminated due to the TIMEOUT parameter
  17.      in CTDLCNFG.SYS.
  18. 2 -- indicates ABNORMAL termination, i.e., the system had an error of some
  19.      sort and has crashed gracefully.
  20. 3 -- indicates that a Remote sysop has taken the system down via Remote
  21.      sysop capabilities.
  22.  
  23.    Furthermore, Citadel-68, when called with ANY argument(s) on the command
  24. line, will leave message in the Aide> room notifying the aides that the
  25. system came up at the time specified in the message header. The argument
  26. itself doesn't matter; it's presence on the command line is the important
  27. part.
  28.  
  29.   And, plus, when CONFIGUR is called with any argument(s) (just like CITADEL,
  30. above), it will assume that it is in unattended mode, and will not ask the
  31. sysop if he wants to erase the files; it will assume that since the sysop is
  32. not around, he wants to preserve his data files, and just scans the files.
  33.  
  34.    What can you do with the above? The following examples are from the
  35. Citadel-86 (MS-DOS) documentation -- similar things can be done with GEMDOS.
  36.  
  37. >   NOTE: All following examples pre-suppose that CITADEL and CONFIGUR are on
  38. >   drive A.
  39. >
  40. >   Suppose we're running with TIMEOUT set to 0.  We'd set up two batch files:
  41. >
  42. >   RUNIT.BAT would contain
  43. >
  44. >   :loop
  45. >   CITADEL %1             <-- if runit gets argument, recovering from cr.
  46. >   if errorlevel 3 goto remotedown <-- CTDL terminated by Remote sysop.
  47. >   if errorlevel 2 fixit        <-- CTDL terminates with crash.
  48. >   if errorlevel 1 goto ridiculous <-- shouldn't terminate with timeout.
  49. >   if errorlevel 0 goto done    <-- sysop termination, just leave.
  50. >   :remotedown            <-- brought down by remote, so we'll have it
  51. >   generic             <-- run "something" and then restart Citadel.
  52. >   goto loop            <-- Now restart Citadel
  53. >   :ridiculous            <-- tell sysop impossibility occurred.
  54. >   rem This is an impossible condition!
  55. >   :done
  56. >
  57. >   and FIXIT.BAT would contain
  58. >
  59. >   CONFIGUR N             <-- Call configuration with unattended arg.
  60. >   RUNIT  SSS            <-- Call runit with crash argument.
  61. >
  62. >
  63. >   Suppose we're running with TIMEOUT set to 1, and the SYSDISK files are on
  64. >   drive C (a RAM disk, which is the usual reason for TIMEOUT).  There would
  65. >   be 3 batch files, and they would look like this:
  66. >
  67. >   RUNIT.BAT
  68. >   c:
  69. >   a:CITADEL %1
  70. >   a:
  71. >   if errorlevel 3 goto weird
  72. >   if errorlevel 2 fixit
  73. >   if errorlevel 1 copyctdl
  74. >   if errorlevel 0 goto done
  75. >   :weird                <-- Assume no Remote sysop abilities
  76. >   REM This shouldn't have happened!    <-- allowed for this installation.
  77. >   fixit
  78. >   :done
  79. >
  80. >   FIXIT.BAT
  81. >   CONFIGUR N
  82. >   RUNIT SSSS
  83. >
  84. >
  85. >   COPYCTDL.BAT
  86. >   rem assume that you would copy from drive c to drive a
  87. >   a:
  88. >   COPY C:*.SYS
  89. >   RUNIT
  90. >
  91. >
  92. >   Always remember that the MSDOS 'if' command doesn't test for values, it
  93. >   tests for levels, so series of 'if errorlevel' statements should always
  94. >   start with the highest possible errorlevel and proceed downward.
  95.