home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: SysTools / SysTools.zip / cimon096.zip / README < prev    next >
Text File  |  2002-04-05  |  5KB  |  152 lines

  1. cimon                                                         Apr 05 2002
  2. -------------------------------------------------------------------------
  3.  
  4. This program provides a command line interface to the "floppy-isdn4linux"
  5. (http://www.fli4l.de) imon daemon, and was written to talk to imond from
  6. within UNIX shell scripts. It has been tested against version 1.5.2 of
  7. imond only, and is placed in the public domain.
  8.  
  9. Direct comments to Rene Herman <rene.herman@mail.com>.
  10.  
  11. Please note that if your question is actually about imond (such as which
  12. commands or queries to send to solve a particular problem) the imond
  13. documentation is far more likely to be helpful than I am, seeing as how
  14. I don't actually (actively) use fli4l myself. Also see the bit below
  15. about sending the `help' command to imond to have it spit back a short
  16. usage screen at you. However, any and all comments about cimon itself
  17. are welcome at the address above.
  18.  
  19.  
  20. Installing
  21. -------------------------------------------------------------------------
  22.  
  23. To compile this program on Linux, simply typing
  24.  
  25.   make
  26.  
  27. should be all you need. Compilation should proceed without warnings
  28. against both libc5 and libc6 (tested with libc-5.4.46 and glibc-2.2.3).
  29. When `make' finishes successfully, install the generated executable by
  30. simply copying it into a directory on your path:
  31.  
  32.   cp cimon /usr/local/bin/
  33.     
  34. /usr/local/bin/ or ~/bin/ could be good choices.
  35.  
  36. Although largely untested, it is expected to compile cleanly on other
  37. UNIX and UNIX-like platforms as well. You may have to override the
  38. Makefile's choice of compiler (gcc) and CFLAGS though. To do so, edit
  39. Makefile or supply alternates on the make command line. For example:
  40.  
  41.   make CC=cc CFLAGS="-O"
  42.  
  43. Please refer to README.OS2 for compilation on OS/2.
  44.  
  45.  
  46. Using
  47. -------------------------------------------------------------------------
  48.  
  49. Type `cimon -h' for a short usage message:
  50.  
  51.   Usage: cimon [OPTION]... HOST [COMMAND]
  52.   Communicate with the IMON daemon at HOST.
  53.  
  54.     -f FILE         read commands from file FILE
  55.     -p PASSWORD     login with password PASSWORD
  56.     -t PORT         connect to HOST at port number PORT
  57.     -h              display this help and exit
  58.     -V              output version information and exit
  59.  
  60.   When COMMAND is absent and FILE is absent or - read commands from stdin.
  61.  
  62. You can provide cimon with commands to send to imond in three ways:
  63.  
  64. - having it read commands from stdin
  65. - having it read commands from a file
  66. - providing commands on the command line
  67.  
  68. The first method is used when you provide no arguments to cimon other
  69. than the mandatory HOST argument. As an example, assuming your imond host
  70. is called `router', the command:
  71.  
  72.   cimon router
  73.   
  74. lets you enter into an interactive session with imond not unlike the one
  75. you would have entered had you typed `telnet router 5000'. Type commands
  76. and hit <enter> to send them to the remote imond (give the `help' command
  77. to have imond present you with a help/usage screen). Ctrl-D will get you
  78. out again (the `quit' command will be send). Alternatively, typing
  79.  
  80.   quit<enter>
  81.   
  82. yourself should get you out by instructing the remote imond to close the
  83. connection. Do not provide the `quit' command yourself during normal
  84. operation though; cimon will consider the broken connection an error.
  85.  
  86. Obviously, all methods the shell provides to redirect stdin are at your
  87. disposal in this mode:
  88.  
  89.   echo channels | cimon router
  90.   
  91.   cimon router <<EOF
  92.   >channels
  93.   >EOF
  94.   
  95.   cimon router < commands.file
  96.   
  97. This last example is an alternative for the second method of providing
  98. cimon with commands - through the use of a command file:
  99.  
  100.   cimon -f commands.file router
  101.  
  102. This program honours the tradition of letting `-' in an input file
  103. option context denote stdin.
  104.  
  105. The third method, providing commands on the command line, is best suited
  106. to single commands:
  107.  
  108.   cimon router channels
  109.   cimon router status 1
  110.   
  111. Note that you can provide more than one command on the command line by
  112. embedding literal newlines:
  113.  
  114.   cimon router channels$'\n'status 1$'\n'status 2
  115.   
  116. but if you need to send more than one command, its probably best to use
  117. a command file or redirect from a here-document:
  118.  
  119.   cimon router <<EOF
  120.   >channels
  121.   >status 1
  122.   >status 2
  123.   EOF
  124.   
  125. If you have setup imond to require a password before accepting commands,
  126. supply it with the `-p PASSWORD' option. It is your responsibility to
  127. supply the admin password if you're sending a command that requires admin
  128. privileges. Use `-t PORT' to change the TCP port from the default (5000),
  129. `-h' to have cimon produce the usage message included above, and `-V' to
  130. have it output its version.
  131.  
  132.  
  133. One further example
  134. -------------------------------------------------------------------------
  135.  
  136. This program was written specifically to check on the online status of a
  137. fli4l router. The following shell script fragment demonstrates how this
  138. can be accomplished. If it's called just when the router is dialing out,
  139. it will pause for a second and then try again.
  140.  
  141. while STATUS=`cimon router status 1` && [ "$STATUS" = "OK Calling" ]; do
  142.   sleep 1
  143. done
  144.  
  145. if [ "$STATUS" = "OK Online" ]; then
  146.   echo Router is online
  147. else
  148.   echo Router is not online
  149. fi
  150.  
  151. -------------------------------------------------------------------------
  152.