head 1.8; access; symbols OSSP_RC_0_7_3:1.8 OSSP_RC_0_7_2:1.8 OSSP_RC_0_7_1:1.8 OSSP_RC_ALPHA_06:1.8 OSSP_RC_EXBROKEN:1.8 OSSP_RC_SPEC:1.6; locks; strict; comment @# @; 1.8 date 2002.02.12.17.59.50; author ms; state Exp; branches; next 1.7; 1.7 date 2002.02.04.22.35.20; author ms; state Exp; branches; next 1.6; 1.6 date 2002.01.31.19.34.53; author ms; state Exp; branches; next 1.5; 1.5 date 2002.01.31.16.38.01; author ms; state Exp; branches; next 1.4; 1.4 date 2002.01.31.16.31.24; author ms; state Exp; branches; next 1.3; 1.3 date 2002.01.30.22.55.26; author ms; state Exp; branches; next 1.2; 1.2 date 2002.01.25.16.04.41; author ms; state Exp; branches; next 1.1; 1.1 date 2002.01.24.17.47.47; author ms; state Exp; branches; next ; desc @@ 1.8 log @Cleanup. PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @## ## rc.example - rcfile template ## ## This file 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 to use 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. # %confvars sftpd_enable="yes" sftpd_anonymous="yes" sftpd_flags="" %common timeStamp # Function from rc.func library %start -p 200 -u root /usr/local/sbin/sftpd -c %stop -p 200 -u root kill -TERM `cat /var/sftp/run/sftpd.pid` %reload -u root kill -HUP `cat /var/sftp/run/sftpd.pid` %restart -u root @@stop # Reference to term section sleep ${nSleep} # Variable nSleep defined at the command line @@start # Reference to start section %status -c /usr/bin/perl print STDERR "Sftpd status report"; for ... %init # Empty section body to prevent %default from running, in # case the user types rc 'rcfile' 'init' on the command line %go -u root @@start # A section with just one reference is an alias %error # We have a rc error logger -p local0.notice "OSSP rc error" # Very rough representation of built-in rc language +logit DAEMON CRITICAL; +outconsole ${rc_errstring}; # rc_errcode is also available +outconsole "Runcommand-level error in line "; +lineno SCRIPT; # Not +lineno ABSOLUTE; +outconsole " of rcfile "; +rcfilename; %default # Gets hit if no other section label matches $HOME/bin/popup "Missing section in rc.sftpd!" # Run custom app @@error # Reference to error section # End stock syntax example rcfile # Generic run commands for example daemon. Using # # custom symbols and unconventional identifiers. # !confvars sftpd_enable="yes" sftpd_anonymous="yes" sftpd_flags="" !prependwith timeStamp # Function from rc.func library !run -p 200 -u root /usr/local/sbin/sftpd -c !term -p 200 -u root kill -TERM `cat /var/sftp/run/sftpd.pid` !hangup -u root kill -HUP `cat /var/sftp/run/sftpd.pid` !termrun -u root &term # Reference to term section sleep ${nSleep} # Variable nSleep defined at the command line &start # Reference to start section !printstat -c /usr/bin/perl print STDERR "Sftpd status report"; for ... !runit # Empty section body to prevent !missing from running, in # case the user types rc 'rcfile' 'runit' on the command line !doit -u root &run # A section with just one reference is an alias !problem # We have a rc error logger -p local0.notice "OSSP rc error" # Very rough representation of built-in rc language +logit DAEMON CRITICAL; +outconsole ${rc_errstring}; # rc_errcode is also available +outconsole "Runcommand-level error in line "; +lineno SCRIPT; # Not +lineno ABSOLUTE; +outconsole " of rcfile "; +rcfilename; !missing # Gets hit if no other section label matches $HOME/bin/popup "Missing section in rc.sftpd!" # Run custom app @@error # Reference to error section # End custom syntax example rcfile # Generic run commands for example daemon. Using an # # XML-like syntax and conventional identifiers. # "yes" "yes" "" timeStamp # Function from rc.func library /usr/local/sbin/sftpd -c kill -TERM `cat /var/sftp/run/sftpd.pid` kill -HUP `cat /var/sftp/run/sftpd.pid` # Reference to term section sleep ${nSleep} # Variable nSleep defined at the command line # Reference to start section print STDERR "Sftpd status report"; for ... # Empty section body to prevent from running, in # case the user types rc 'rcfile' 'init' on the command line # A section with just one reference is an alias # We have a rc error logger -p local0.notice "OSSP rc error" # Very rough representation of built-in rc language +logit DAEMON CRITICAL; +outconsole ${rc_errstring}; # rc_errcode is also available +outconsole "Runcommand-level error in line "; +lineno SCRIPT; # Not +lineno ABSOLUTE; +outconsole " of rcfile "; +rcfilename; # Gets hit if no other section label matches $HOME/bin/popup "Missing section in rc.sftpd!" # Run custom app # Reference to error section # End XML-like syntax example rcfile # Generic run commands for example daemon. Using a # # ASN.1-like syntax and conventional identifiers. # config CONFIG BEGIN sftpd_enable STRING ::= "yes" sftpd_anonymous STRING ::= "yes" sftpd_flags STRING ::= "" END common COMMON BEGIN timeStamp # Function from rc.func library 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 ${nSleep} # Variable nSleep defined at the command line start REFER # Reference to start section END status SECTION ::= { priority INTEGER ::= 100 interpreter STRING ::= "/usr/bin/perl" } BEGIN print STDERR "Sftpd status report"; for ... END init SECTION ::= {} # Empty section body to prevent default from running, in BEGIN # case the user types rc 'rcfile' 'init' on the command line END go SECTION ::= { user STRING ::= "root" } BEGIN start REFER # A section with just one reference is an alias END error ERROR # We have a rc error BEGIN logger -p local0.notice "OSSP rc error" # Very rough representation of built-in rc language +logit DAEMON CRITICAL; +outconsole ${rc_errstring}; # rc_errcode is also available +outconsole "Runcommand-level error in line "; +lineno SCRIPT; # Not +lineno ABSOLUTE; +outconsole " of rcfile "; +rcfilename; END default DEFAULT # Gets hit if no other section label matches BEGIN $HOME/bin/popup "Missing section in rc.sftpd!" # Run custom app error REFER # Reference to error section END # End ASN.1-like syntax example rcfile @ 1.7 log @Fixed copyright. PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d53 2 a54 1 %error # We have a rc (not user-level) error d103 2 a104 1 !problem # We have a rc (not user-level) error d161 2 a162 1 # We have a rc (not user-level) error d246 1 a246 2 error ERROR # We have a rc (not user-level) error # Very rough representation of built-in rc language d248 2 @ 1.6 log @Add passed-in arguments, rc_errstring and rc_errcode, section aliases, and empty section bodies. PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d4 1 a4 1 ## This file examines different ways of writing runcommands for a ## d6 1 a6 1 ## would have a name like 'rc.helloworld' and contain runcommands ## d19 2 a20 2 # Generic runcommands for example daemon. Using # # default symbols and conventional identifiers. # d68 2 a69 2 # Generic runcommands for example daemon. Using # # custom symbols and unconventional identifiers. # d117 2 a118 2 # Generic runcommands for example daemon. Using an # # XML-like syntax and conventional identifiers. # d176 2 a177 2 # Generic runcommands for example daemon. Using a # # ASN.1-like syntax and conventional identifiers. # @ 1.5 log @Add 'error' section for generic rcfile error handling. Add 'default' section (modeled after the 'switch' C statement) for user-level processing in case a section label is missing. Please review. PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d40 3 a42 3 @@stop # Reference to term section sleep 2 @@start # Reference to start section d48 6 a53 1 %error # We have a rc (not user-level) error d55 2 a56 3 +syslogit DAEMON CRITICAL; +if ${sftpd_error} +outconsole ${sftpd_error}; d89 3 a91 3 &term # Reference to term section sleep 2 &start # Reference to start section d97 5 d104 2 a105 3 +syslogit DAEMON CRITICAL; +if ${sftpd_error} +outconsole ${sftpd_error}; d144 1 a144 1 sleep 2 d153 6 d161 2 a162 3 +syslogit DAEMON CRITICAL; +if ${sftpd_error} +outconsole ${sftpd_error}; d218 3 a220 3 stop REFER # Reference to term section sleep 2 start REFER # Reference to start section d232 11 d246 2 a247 3 +syslogit DAEMON CRITICAL; +if ${sftpd_error} +outconsole ${sftpd_error}; @ 1.4 log @Added common section, but mostly cleanup work. PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d47 14 d92 14 d144 16 d217 18 @ 1.3 log @Add ASN.1 example, revise and correct manpages, update todo list. PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d2 1 a2 1 ## rc.example d4 14 a17 13 ## 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. d19 2 a20 2 # Generic run commands for example daemon. Using native # # rc default symbols and conventional identifiers. # a23 1 sftpd_interpreter="/usr/bin/sh" d27 3 d40 1 a40 1 @@stop # reference to term section d42 1 a42 1 @@start # reference to start section d47 2 d50 1 a50 1 # Generic run commands for example daemon. Using # a54 1 sftpd_interpreter="/usr/bin/sh" d58 4 a61 1 !start -p 200 -u root d70 2 a71 2 !restart -u root &term # reference to term section d73 1 a73 1 &start # reference to start section d75 1 a75 1 !status -c /usr/bin/perl d78 2 d81 2 a82 2 # Generic run commands for example daemon. Using an # # XML-like syntax and conventional identifiers. # a85 1 "/usr/bin/sh" d90 4 d107 1 a107 1 # reference to term section d109 1 a109 1 # reference to start section d116 1 d118 3 a120 2 # Generic run commands for example daemon. Using a # # ASN.1-like syntax and conventional identifiers. # a124 1 sftpd_interpreter STRING ::= "/usr/bin/sh" d129 5 d161 1 a161 1 stop REFER # reference to term section d163 1 a163 1 start REFER # reference to start section d166 1 a166 1 restart SECTION ::= { d174 1 @ 1.2 log @Added detail to examples, and studied of abstract syntax in rc.files and rc.conf. PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d4 13 d18 2 a19 2 # Generic run commands for example daemon. Using # # default symbols and conventional identifiers. # d45 2 a46 2 # Generic run commands for example daemon. Using # # custom symbols and unconventional identifiers. # d72 2 a73 2 # Generic run commands for example daemon. Using # # abstract syntax and conventional identifiers. # d104 52 @ 1.1 log @Buildconf and example files. PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d5 29 a33 2 # Generic run commands for example daemon. # # Using custom symbols and identifiers. # d37 1 d55 13 d69 1 a69 9 # Generic run commands for example daemon. # # Using default symbols and identifiers. # %confvars sftpd_enable="yes" sftpd_anonymous="yes" sftpd_flags="" %start -p 200 -u root d71 1 d73 1 a73 1 %term -p 200 -u root d75 1 d77 1 a77 1 %hangup -u root d79 1 d81 2 a82 2 %restart -u root @@term # reference to term section d84 7 a90 1 @@start # reference to start section @