OSSP CVS Repository

ossp - Check-in [1730]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1730
Date: 2002-Jan-30 23:55:26 (local)
2002-Jan-30 22:55:26 (UTC)
User:ms
Branch:
Comment: Add ASN.1 example, revise and correct manpages, update todo list.

PR: Submitted by: Reviewed by: Approved by: Obtained from:

Tickets:
Inspections:
Files:
ossp-pkg/rc/00TODO      1.12 -> 1.13     11 inserted, 15 deleted
ossp-pkg/rc/rc-sample.pod      1.5 -> 1.6     1 inserted, 1 deleted
ossp-pkg/rc/rc.example      1.2 -> 1.3     71 inserted, 6 deleted
ossp-pkg/rc/rc.pod      1.23 -> 1.24     71 inserted, 50 deleted

ossp-pkg/rc/00TODO 1.12 -> 1.13

--- 00TODO       2002/01/30 17:29:15     1.12
+++ 00TODO       2002/01/30 22:55:26     1.13
@@ -3,34 +3,30 @@
 Spec fehlt
   Security
     Off switch
-  Command interpreter
+  Command interpreter (probably goes in rc.usecase.pod)
     Beispiel
     Default
     Error
-  Inconsistent
-    rc.conf rc.config rc.env
-    package command program section rcfile rc.file
-    runcommand run command (run-command?)
-  Environment
-    Genaue wie comline- und rc.conf Optionen
-    Ausname drei schon stehen
+  Section arguments (rc sshd restart 2)
+  Control flow
+    Errors during execution
+      Multiple sections given
+      Wildcard 'all' given
+      Both wildcard and multiple sections
+    Avoid a silent failure when giving non-existent run commands (Marcus.)
+    Use case - give 'restart' command in place of 'start' to stopped prog
+      User assumes stop implicitly dropped if program not running
 
 Consider
   Make return code and error definitions unique to OSSP rc.
   Offer include directive in config file.
+  Environment of manpage has redundant text.
 
 Must do
   Strip local popt code, and move in OSSP popt library.
   Translate rc bourne shell script to ANSI C.
   Finish man page. Start latex or Docbook guide.
   If a variable is defined for which no default exists, warn user (Scholli.)
-  Avoid a silent failure when giving non-existent run commands (Marcus.)
-
-Automated environment
-  Stock rc.func includes AddPath, DelPath, PermMask.
-
-Error handling
-  Classic error, give 'restart' command in place of 'start' to stopped prog
 
         /-------------------OSSP rc Inhalt------------------\
         | Manpage                                           |


ossp-pkg/rc/rc-sample.pod 1.5 -> 1.6

--- rc-sample.pod        2002/01/30 08:00:04     1.5
+++ rc-sample.pod        2002/01/30 22:55:26     1.6
@@ -124,7 +124,7 @@
 
 =back
 
-With this setup, the following use cases are possible:
+With this setup, the following transactions are possible:
 
  $ /cw/etc/rc --query "foo enabled: %{foo_enable}"
  foo enabled: yes


ossp-pkg/rc/rc.example 1.2 -> 1.3

--- rc.example   2002/01/25 16:04:41     1.2
+++ rc.example   2002/01/30 22:55:26     1.3
@@ -1,9 +1,22 @@
 ##
 ##  rc.example
 ##
+##  Examines different ways of writing run commands for a program.
+##  If used in production, this file would be different. It would
+##  have a name like 'rc.helloworld' and contain run commands for
+##  the 'helloworld' program. It would also have only one notation.
+##  A sample is repeated in this document using rc (native), XML,
+##  and ASN.1 notation. The same rcfile semantics are repeated only
+##  to show what is possible through the abstract syntax offered by
+##  OSSP rc.
+##
+##  To learn what regular expressions must be used with the example
+##  example syntaxes in this document, refer to the rc.conf file
+##  included with the original OSSP rc distribution. It has the
+##  corresponding regular expressions settings.
 
-#  Generic run commands for example daemon. Using #
-#  default symbols and conventional identifiers.  #
+# Generic run commands for example daemon. Using native #
+# rc default symbols and conventional identifiers.      #
 
 %confvars
     sftpd_enable="yes"
@@ -29,8 +42,8 @@
     print STDERR "Sftpd status report";
     for ...
 
-#  Generic run commands for example daemon. Using   #
-#  custom symbols and unconventional identifiers.   #
+# Generic run commands for example daemon. Using #
+# custom symbols and unconventional identifiers. #
 
 !confvars
     sftpd_enable="yes"
@@ -56,8 +69,8 @@
     print STDERR "Sftpd status report";
     for ...
 
-#  Generic run commands for example daemon. Using #
-#  abstract syntax and conventional identifiers.  #
+# Generic run commands for example daemon. Using an #
+# XML-like syntax and conventional identifiers.     #
 
 <config>
     <set name=sftpd_enable>"yes"</set>
@@ -88,3 +101,55 @@
     print STDERR "Sftpd status report";
     for ...
 </status>
+
+# Generic run commands for example daemon. Using a #
+# ASN.1-like syntax and conventional identifiers.  #
+
+config CONFIG
+    BEGIN
+        sftpd_enable STRING ::= "yes"
+        sftpd_interpreter STRING ::= "/usr/bin/sh"
+        sftpd_anonymous STRING ::= "yes"
+        sftpd_flags STRING ::= ""
+    END
+
+start SECTION ::= {
+    priority INTEGER ::= 200
+    user STRING ::= "root"
+}
+    BEGIN
+        /usr/local/sbin/sftpd -c
+    END
+
+stop SECTION ::= {
+    priority INTEGER ::= 200
+    user STRING ::= "root"
+}
+    BEGIN
+        kill -TERM `cat /var/sftp/run/sftpd.pid` 
+    END
+
+reload SECTION ::= {
+    user STRING ::= "root"
+}
+    BEGIN
+        kill -HUP `cat /var/sftp/run/sftpd.pid` 
+    END
+
+restart SECTION ::= {
+    user STRING ::= "root"
+}
+    BEGIN
+        stop REFER      # reference to term section
+        sleep 2
+        start REFER     # reference to start section
+    END
+
+restart SECTION ::= {
+    priority INTEGER ::= 100
+    interpreter STRING ::= "/usr/bin/perl"
+}
+    BEGIN
+        print STDERR "Sftpd status report";
+        for ...
+    END


ossp-pkg/rc/rc.pod 1.23 -> 1.24

--- rc.pod       2002/01/29 15:35:05     1.23
+++ rc.pod       2002/01/30 22:55:26     1.24
@@ -1,5 +1,5 @@
 ##
-##  rc.pod -- OSSP Run Command Processor (Manual Page)
+##  rc.pod -- OSSP Runcommand Processor (Manual Page)
 ##  Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
 ##  Copyright (c) 2000-2002 The OSSP Project <http://www.ossp.org/>
 ##  Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.com>
@@ -29,7 +29,7 @@
 
 =over 4
 
-B<rc> - OSSP Run Command Processor
+B<rc> - OSSP Runcommand Processor
 
 =back 4
 
@@ -71,24 +71,23 @@
 
 =over 4
 
-OSSP rc is a run command processor. It's primary function is to  scan
-F<rcfile> script files for B<section>(s) and run the commands listed in the
-section(s).
+OSSP rc is a runcommand processor. Its primary function is to scan F<rcfile>
+script files for B<section>(s) and run the commands listed in the section(s).
 
-The run command processor can alternatively print the commands in human
+The runcommand processor can alternatively print the commands in human
 readable format or reformat them for shell C<eval> input without executing
 them. The F<rcfile> files contain variables and the command processor has
 functionality to query their default, set and effective values.
 
 The structure of the F<rcfile>s is simple but the syntax is highly
-configurable.  A F<rcfile> is divided into B<section>s and each of them is
-identified by a label build from the B<section> name.  The distribution
+configurable. A F<rcfile> is divided into B<section>s and each of them is
+identified by a label build from the B<section> name. The distribution
 contains various examples.
 
 With a single call to rc usually one F<rcfile> may be processed at, although
-many sections can be passed which are executed in given order.  The only
-exception to this rule is when the reserved keyword `all' is used as F<rcfile>
-meaning `all F<rcfile>s.'
+many B<sections> can be passed which are executed in given order. The only
+exception to this rule is when the reserved keyword 'all' is used as F<rcfile>
+meaning 'all F<rcfile>s.'
 
 =back 4
 
@@ -106,8 +105,8 @@
 =item B<-L>|B<--locate> I<file>[C<:>I<part>]
 
 locations to search for F<rcfile>s where I<file> can contain regex patterns to
-filter files and the optional part is a regex to filter out parts of a file.
-This option can be specified more than once.
+filter files. The trailing part (after the ':') is a regex filter used to
+ignore parts of a file. This option can be specified more than once.
 
 =item B<-V>|B<--version>
 
@@ -115,8 +114,10 @@
 
 =item B<-c>|B<--conf> I<file>[C<:>I<file>[...]]
 
-specify the location of the configuration file.  If omitted, the fallback is
-to look for C<$OSSP_RC_CONF>, and "@l_prefix@/etc/rc.conf", in that order.
+specify the location of the configuration file. If omitted, C<$OSSP_RC_CONF>
+will be examined. If absent, F<@l_prefix@/etc/rc.conf> will be used. If no
+F<rc.conf> exists at all, then only command line and environment specified
+options will override the defaults built-in to OSSP rc.
 
 =item B<-e>|B<--eval>
 
@@ -151,9 +152,9 @@
 
 =item B<-r>|B<--raw>
 
-output text using no terminal control sequences.  The rc facility usually
+output text using no terminal control sequences. The rc facility usually
 tries to improve output text for human readability using terminal control
-sequences for color, bold and italic rendering.  The default is determines at
+sequences for color, bold and italic rendering. The default is determines at
 runtime and is automagically disabled if stdout is detached from a terminal.
 
 =item B<-s>|B<--silent>
@@ -162,7 +163,7 @@
 
 =item B<-t>|B<--tmp> I<dir>
 
-specify the location of the temporary directory.  If omitted, the fallback is
+specify the location of the temporary directory. If omitted, the fallback is
 to look for C<$TMPDIR>, C<$TMPDIR>, try using C<~/tmp> and C</tmp>, in that
 order.
 
@@ -206,13 +207,20 @@
 
 =back 4
 
+Every command line longoption corresponds to a keyword in the F<rc.conf> file.
+When prefixed with 'OSSP_RC_' and its name in upper case, an option can be set
+as an environment variable. First, options from the F<rc.conf> file are read.
+Then, options from the environment are read. Last, options from the command
+line are read. This allows for flexibility when wishing to set a standard set
+of OSSP rc options, and override them conditionally.
+
 =head1 ENVIRONMENT
 
 =over 4
 
-Every command line longoption is also a keyword in the F<rc.conf> file and,
-prefixed with "OSSP_RC_" and it's name in upper case, also available as an
-environment variable.
+The environment contains options just as the command line and F<rc.conf> file
+does. An option's corresponding environment variable name must start with
+'OSSP_RC_' and be all upper case.
 
 =back 4
 
@@ -228,55 +236,68 @@
 
 =head1 EXAMPLES
 
-=over 4
-
-Some short one line examples include the following. Note that a run command
-consists of a single program name and one or more sections. The wildcard `all'
-can be given in place of a program name to denote all programs with entries in
-the rc registry F<$OSSP_RC_ROOT/rc.d>.
+A runcommand consists of a single program name and one or more sections. The
+wildcard 'all' can be given in place of a program name to denote all programs
+with entries in the rc registry F<$OSSP_RC_ROOT/rc.d>. The following are
+one-line examples of commonly used rc commands.
 
   /usr/local/bin/rc --info
-  /etc/rc --query lmtp2nntp
-  /mybin/rc sshd start
-  /etc/rc lmtp2nntp start
-  /sfw/etc/rc --conf /etc/rc.conf --debug smtpd stop
+  /sbin/rc --query lmtp2nntp
+  /cw/etc/rc --conf /etc/rc.conf --debug smtpd stop
+  /mybin/rc sshd start LOG_USER  # calls logger(1) and passes LOG_USER
+  /etc/rc lmtp2nntp start 2      # sleep for 2 seconds before returning
   /sfw/etc/rc --silent ntpd start sync stop start
-  /usr/local/bin/rc httpd restart
+  /usr/local/bin/rc httpd reload # sends a HUP signal
+  /etc/rc.d/rc.rsyncd restart 4  # leave a 4 second pause between start and stop
+  /cw/etc/rc.d/rc.ftpd start 32  # a maximum of 32 users can connect
 
-To evaluate a run command for all programs with an identical section name, a
+To evaluate a runcommand for all programs with an identical section name, a
 short expression can be written into a F<.profile> file. When the shell
-initializes itself, the run commands will execute according to the C<eval>
+initializes itself, the runcommands will execute according to the C<eval(1)>
 command. This is often seen when importing the environment of packages of an
-B<OpenPKG> hierarchy.
+B<OpenPKG> hierarchy, but is always a custom modification made by the user.
+
+  $ eval `@l_prefix@/etc/rc --eval all env`
 
 =head1 FILES
 
-F<rc.conf>          - Master configuration file
-F<rc.func>          - User defined functions library
-F<rc.env>           - Postprocess variable declaration file
-F<rc.foo>           - Run commands for "foo" application
+=over 4
+
+F<rc.conf> - Master configuration file
+F<rc.func> - User defined functions library
+F<rc.env>  - Postprocess variable declaration file
+F<rc.foo>  - Runcommands for 'foo' application
+
+=back 4
 
 =head1 SEE ALSO
 
-OSSP rc integrates concepts taken from other run command architectures. For
-more information, inspect the /etc/rc structures provided by FreeBSD, Solaris,
-and Red Hat distributions.
+=over 4
 
-rc.conf(1), rc.func(1), rc.env(1), rcfile(1), and rc-sample(1).
+OSSP rc integrates concepts taken from other runcommand architectures. For
+more information, inspect the /etc/rc structures provided by the FreeBSD,
+Solaris, and Red Hat distributions.
+
+rc-sample(5), rc.conf(1), and rcfile(1).
+
+=back 4
 
 =head1 AUTHORS
 
-Ralf S. Engelschall
+=over 4
 
+Ralf S. Engelschall
 Michael Schloh von Bennewitz
 
+=back 4
+
 =head1 HISTORY
 
-B<OSSP rc> is a replacement for the prototype run command facility used in the
-OpenPKG project (http://www.openpkg.org/). The prototype was a slow and less
-robust Bourne shell script. B<OSSP rc> is intended to faster, more robust, and
-more flexible. This flexibility allows for wider range of use, however. B<OSSP
-rc> can therefore be used in a variety of situations, and is no longer
-exclusive to the OpenPKG project.
+B<OSSP rc> is a drop-in replacement for the prototype runcommand facility used
+in OpenPKG (http://www.openpkg.org/). The prototype was a slow and less robust
+Bourne shell script. B<OSSP rc> is comparitively faster, more robust, and more
+flexible. This flexibility allows for wider range of use, and B<OSSP rc> can
+therefore be used in a variety of situations. It is no longer exclusive to the
+OpenPKG project.
 
 =cut

CVSTrac 2.0.1