home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / MorphOS / Epic4_mos / share / epic / help / 5_programming / exec < prev    next >
Encoding:
Text File  |  2002-10-28  |  4.8 KB  |  116 lines

  1. Synopsis:
  2.    exec [<shell commands>]
  3.    exec -direct <commands>
  4.    exec -name <name> <shell commands>
  5.    exec -out <process id|shell commands>
  6.    exec -msg <nickname|channel> <process id|shell commands>
  7.    exec -notice <nickname|channel> <process id|shell commands>
  8.    exec -in <process id> <text to send to process>
  9.    exec -window <process id|shell commands>
  10.    exec -<signal> <process id>
  11.    exec -close <process id>
  12.  
  13. Description:
  14.    EXEC allows you to spawn other processes from within your client,
  15.    which are naturally treated as child processes.  For example, if you
  16.    wished to check your email without suspending your client (or
  17.    quitting irc), you could simply EXEC your favorite mail program.
  18.  
  19.    Processes can be given unique names, allowing them to be referred to
  20.    more intuitively than trying to figure out its process id number. 
  21.    Processes can also accept any signal normally available through use
  22.    of the Unix "kill" command (letting you kill, suspend, etc. any
  23.    process that accepts such a signal).  Process identifiers begin with
  24.    a "%".  Thus, a process named "mail" with pid 0 could be referred to
  25.    as either "%mail" or "%0".
  26.  
  27.    EXEC can take several different flags, each of which allow you to
  28.    manipulate the subprocess in different ways.  At the most basic
  29.    level, the only argument you really need to give is the external
  30.    program to run.  If no arguments are given at all, a list of any
  31.    currently running processes is returned.
  32.  
  33.    When using the -OUT, -MSG, or -NOTICE flags, output can be sent to
  34.    the target upon startup of the subprocess, or redirected to it after
  35.    it's already running by using its process id.
  36.    
  37.    Another flag of note, -CLOSE, can be used to shut down renegade
  38.    subprocesses that simply won't go away (i.e. with their own quit
  39.    command, with the KILL signal, etc.).  This actually just severs the
  40.    link between the subprocess and the client, so it will die on its
  41.    own the next time it tries to send data to the client.
  42.    
  43.    Something to remember when worried about a shell processing arguments
  44.    is the -DIRECT flag, which executes the commands without spawning a
  45.    shell. This can cut down on security risks, and save some memory.
  46.  
  47. Options:
  48.    -direct     executes commands without spawning a shell
  49.    -name       give the subprocess a logical name
  50.    -out        send subprocess output to your current channel
  51.    -msg        send subprocess output to a nick or channel with MSG
  52.    -notice     send subprocess output to a nick or channel with NOTICE
  53.    -in         send a text string to the specified subprocess
  54.    -window     redirect subprocess output to another window
  55.    -<signal>   send SIG<signal> to the subprocess
  56.    -close      forcibly kill the subprocess and its children
  57.  
  58. Examples:
  59.    (Assume that the process used with these examples is the Unix mail
  60.    program.)
  61.  
  62.    To start a process:
  63.       /exec mail
  64.  
  65.    To start a process without a shell interfering:
  66.       /exec -direct mail
  67.         
  68.    To start a process and give it a human-readable name:
  69.       /exec -name mail mail
  70.  
  71.    To send the output of a new subprocess to your current channel:
  72.       /exec -out mail
  73.  
  74.    To send the output of a running subprocess to JoeBob with a MSG:
  75.       /exec -msg joebob %mail
  76.  
  77.    To send the output of a new subprocess to #blah with a NOTICE:
  78.       /exec -notice #blah mail
  79.  
  80.    To send a text string (command) to a running subprocess:
  81.       /exec -in %mail ?
  82.  
  83.    To send a running subprocess the KILL signal:
  84.       /exec -kill %mail
  85.  
  86.    To forcibly close down a stubborn subprocess that just won't die:
  87.       /exec -close %mail
  88.       
  89. Aliases:
  90.    When using EXEC with the -IN flag, the functionality is identical to
  91.    using MSG to send a message to a process.  See MSG for more
  92.    information.
  93.  
  94. See Also:
  95.    msg(1); set(4) exec_protection, notify_on_termination, security, shell,
  96.    shell_flags, shell_limit
  97.  
  98. Restrictions:
  99.    Use of external programs from within irc can sometimes be dangerous
  100.    if you don't know what you're doing.  The danger doesn't necessarily
  101.    lie in the external programs themselves, but rather in any lack of
  102.    knowledge about them you may have.  When all else fails, don't use a
  103.    command if you don't know what it does.
  104.  
  105.    You can explicitly limit your ability to use EXEC in several ways. 
  106.    If EXEC_PROTECTION is set to ON, ircII-EPIC will not permit EXEC to
  107.    be used from within any ON hook.  If SECURITY has the 1 bit set, the
  108.    client will only permit EXEC to be used interactively; using it from
  109.    within aliases is not allowed.  For real security, you can #define
  110.    RESTRICTED at compile time, which will completely disable EXEC.
  111.  
  112. Other Notes:
  113.    The available signals that may be sent to a process will vary from system
  114.    to system.
  115.  
  116.