Wed, 07 Jan 2009 14:59:38 +0100
Port miniperl and rpmio components to Solaris 11.
michael@13 | 1 | ## |
michael@13 | 2 | ## rc.pod -- RPM Auxiliary Tool (Manual Page) |
michael@13 | 3 | ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@13 | 4 | ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/> |
michael@13 | 5 | ## |
michael@13 | 6 | ## Permission to use, copy, modify, and distribute this software for |
michael@13 | 7 | ## any purpose with or without fee is hereby granted, provided that |
michael@13 | 8 | ## the above copyright notice and this permission notice appear in all |
michael@13 | 9 | ## copies. |
michael@13 | 10 | ## |
michael@13 | 11 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@13 | 12 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@13 | 13 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@13 | 14 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@13 | 15 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@13 | 16 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@13 | 17 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@13 | 18 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@13 | 19 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@13 | 20 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@13 | 21 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@13 | 22 | ## SUCH DAMAGE. |
michael@13 | 23 | ## |
michael@13 | 24 | |
michael@13 | 25 | =pod |
michael@13 | 26 | |
michael@13 | 27 | =head1 NAME |
michael@13 | 28 | |
michael@13 | 29 | B<@l_prefix@/bin/openpkg rc> - OpenPKG Run-Command Processor |
michael@13 | 30 | |
michael@13 | 31 | =head1 SYNOPSIS |
michael@13 | 32 | |
michael@13 | 33 | B<@l_prefix@/bin/openpkg rc> [B<-s>|B<--silent>] [B<-v>|B<--verbose>] [B<-d>|B<--debug>] [B<-k>|B<--keep>] I<package> I<command> [I<command> ...] |
michael@13 | 34 | |
michael@13 | 35 | B<@l_prefix@/bin/openpkg rc> B<-p>|B<--print> I<package> I<command> [I<command> ...] |
michael@13 | 36 | |
michael@13 | 37 | eval `B<@l_prefix@/bin/openpkg rc> B<-e>|B<--eval> I<package> I<command> [I<command> ...]` |
michael@13 | 38 | |
michael@13 | 39 | B<@l_prefix@/bin/openpkg rc> B<-q>|B<--query> I<variable> [I<variable> ...] |
michael@13 | 40 | |
michael@13 | 41 | B<@l_prefix@/bin/openpkg rc> B<-c>|B<--config> |
michael@13 | 42 | |
michael@13 | 43 | B<@l_prefix@/bin/openpkg rc> B<-h>|B<--help> |
michael@13 | 44 | |
michael@13 | 45 | =head1 DESCRIPTION |
michael@13 | 46 | |
michael@13 | 47 | The B<@l_prefix@/bin/openpkg rc> program is the run-command (rc) processor |
michael@13 | 48 | of the B<OpenPKG> instance C<@l_prefix@>. It allows querying the rc |
michael@13 | 49 | configuration variables and the execution of rc command scripts of one |
michael@13 | 50 | or more installed B<OpenPKG> packages. The implemented run-command |
michael@13 | 51 | facility is partly modeled after the classical UNIX(tm) System V |
michael@13 | 52 | run-command facility plus ideas taken from the FreeBSD and NetBSD |
michael@13 | 53 | run-command facilities. It mainly merges the classical startup/shutdown |
michael@13 | 54 | procedures with periodical procedures into a single approach. |
michael@13 | 55 | |
michael@13 | 56 | =head1 USAGE |
michael@13 | 57 | |
michael@13 | 58 | =over 4 |
michael@13 | 59 | |
michael@13 | 60 | =item B<@l_prefix@/bin/openpkg rc> [B<-s>|B<--silent>] [B<-v>|B<--verbose>] [B<-d>|B<--debug>] [B<-k>|B<--keep>] I<package> I<command> [I<command> ...] |
michael@13 | 61 | |
michael@13 | 62 | B<Run-Command Execution.> This executes one or more specified |
michael@13 | 63 | I<command>s in a particular I<package> or in all installed packages if |
michael@13 | 64 | I<package> is "C<all>". Option B<--silent> can be used to explicitly |
michael@13 | 65 | disable progress messages on C<stderr>. Option B<--verbose> can be used |
michael@13 | 66 | to explicitly enable progress messages on C<stderr>. By default, B<rc> |
michael@13 | 67 | automatically determines whether progress messages should be displayed |
michael@13 | 68 | or not depending on whether C<stderr> is connected to a terminal device. |
michael@13 | 69 | Option B<--keep> can be used for debugging purposes to keep the |
michael@13 | 70 | temporary files were generated during internal processing. |
michael@13 | 71 | |
michael@13 | 72 | =item B<@l_prefix@/bin/openpkg rc> B<-p>|B<--print> I<package> I<command> [I<command> ...] |
michael@13 | 73 | |
michael@13 | 74 | B<Run-Command Printing.> This is like the run-command execution (see |
michael@13 | 75 | above), but instead of immediately executing all involved individual |
michael@13 | 76 | run-command scripts, they are concatenated (but with all configuration |
michael@13 | 77 | parts reduced to a single configuration part) and printed to C<stdout>. |
michael@13 | 78 | Use this for debugging or post-processing purposes. |
michael@13 | 79 | |
michael@13 | 80 | =item eval `B<@l_prefix@/bin/openpkg rc> B<-e>|B<--eval> I<package> I<command> [I<command> ...]` |
michael@13 | 81 | |
michael@13 | 82 | B<Run-Command Evaluation.> This is like the run-command execution |
michael@13 | 83 | (see above), but the resulting exported shell environment variables |
michael@13 | 84 | are output to a temporary file as a (Bourne-Shell or C-Shell syntax) |
michael@13 | 85 | shell script, suitable for evaluation within the shell environment |
michael@13 | 86 | of the caller. A one-line script is printed to C<stdout> which then |
michael@13 | 87 | "sources" (and immediately removes) this temporary file. This is |
michael@13 | 88 | slightly different from printing the temporary script directly to |
michael@13 | 89 | C<stdout>, because not all shell implementations like to "B<eval>" |
michael@13 | 90 | large multi-line scripts. Hence, use this for executing the "C<env>" |
michael@13 | 91 | run-commands within the current shell. |
michael@13 | 92 | |
michael@13 | 93 | =item B<@l_prefix@/bin/openpkg rc> B<-q>|B<--query> I<variable> [I<variable> ...] |
michael@13 | 94 | |
michael@13 | 95 | B<Configuration Variable Querying.> This queries the effective values |
michael@13 | 96 | (see B<RUN-COMMAND CONFIGURATION> section below) of one or more |
michael@13 | 97 | run-command configuration I<variable>s. Use this within a shell script |
michael@13 | 98 | to selectively query a particular variable. |
michael@13 | 99 | |
michael@13 | 100 | =item B<@l_prefix@/bin/openpkg rc> B<-c>|B<--config> |
michael@13 | 101 | |
michael@13 | 102 | B<Configuration Variable Summary.> This displays on C<stdout> a |
michael@13 | 103 | three-column table showing the name, default and effective values of |
michael@13 | 104 | all run-command configuration variables. If C<stdout> is connected to |
michael@13 | 105 | terminal device, variables where the default and effective values differ |
michael@13 | 106 | are shown in bold mode. |
michael@13 | 107 | |
michael@13 | 108 | =item B<@l_prefix@/bin/openpkg rc> B<-h>|B<--help> |
michael@13 | 109 | |
michael@13 | 110 | B<Requesting Help.> This just displays a short summary of |
michael@13 | 111 | the usage for this program. |
michael@13 | 112 | |
michael@13 | 113 | =back |
michael@13 | 114 | |
michael@13 | 115 | =head1 FILES |
michael@13 | 116 | |
michael@13 | 117 | =head2 RUN-COMMAND FILES (C<@l_prefix@/bin/openpkg rc.d/rc.*>) |
michael@13 | 118 | |
michael@13 | 119 | The foundation of the B<OpenPKG> run-command facility are the individual |
michael@13 | 120 | run-command files C<rc.*> of the installed packages. They are all |
michael@13 | 121 | located in the directory C<@l_prefix@/bin/openpkg rc.d/> and are named |
michael@13 | 122 | "C<rc.>I<package>". They consist of one or more sections, each starting |
michael@13 | 123 | with a section header "C<%>I<name> [I<options>]" and following a GNU |
michael@13 | 124 | Bash compatible shell script. There are three classes of sections: |
michael@13 | 125 | |
michael@13 | 126 | =over 4 |
michael@13 | 127 | |
michael@13 | 128 | =item B<Special Sections> |
michael@13 | 129 | |
michael@13 | 130 | There are 2 sections which have a special meaning to the B<rc> program |
michael@13 | 131 | and cannot be used for different purposes. |
michael@13 | 132 | |
michael@13 | 133 | =over 4 |
michael@13 | 134 | |
michael@13 | 135 | =item C<%config> |
michael@13 | 136 | |
michael@13 | 137 | This section has to consist of run-command configuration |
michael@13 | 138 | variable default settings in Bourne-Shell syntax only, i.e., |
michael@13 | 139 | it has to contain one or more lines, each of exactly the form |
michael@13 | 140 | "I<package>C<_>I<variable>C<=>I<value>". Notice that in section |
michael@13 | 141 | "C<%config>" of run-command file "C<rc.foo>" the variables all have |
michael@13 | 142 | to be prefixed (by convention) with "C<foo_>". It is allowed that the |
michael@13 | 143 | I<value>s reference other variables defined before in the same section |
michael@13 | 144 | or from the "C<%config>" section of the bootstrap package "C<openpkg>". |
michael@13 | 145 | Additionally, by convention all lines have to be indented by 4 spaces. |
michael@13 | 146 | |
michael@13 | 147 | NOTICE: All sections of all run-command scripts see all C<%config> |
michael@13 | 148 | sections of all packages. |
michael@13 | 149 | |
michael@13 | 150 | =item C<%common> |
michael@13 | 151 | |
michael@13 | 152 | This section can consist of an arbitrary shell script |
michael@13 | 153 | which is automatically prepended to the shell scripts |
michael@13 | 154 | of all other sections on execution. It is usually used |
michael@13 | 155 | to define common and local variables and functions. |
michael@13 | 156 | |
michael@13 | 157 | =back |
michael@13 | 158 | |
michael@13 | 159 | =item B<Conventional Sections> |
michael@13 | 160 | |
michael@13 | 161 | There are 9 sections which have no special meaning to the B<rc> program, |
michael@13 | 162 | but are used in B<OpenPKG> by convention for standard purposes. Hence, |
michael@13 | 163 | do not use them for arbitrary things instead. |
michael@13 | 164 | |
michael@13 | 165 | Throughout these sections it is possible to specify the user to be |
michael@13 | 166 | switched to before the code is executed. |
michael@13 | 167 | |
michael@13 | 168 | A priority can be given for each section to control execution sequence |
michael@13 | 169 | if "C<all>" packages are given. Higher priority leads to earlier |
michael@13 | 170 | starting and later stopping. The priority is a number where low numbers |
michael@13 | 171 | mean high priority (numerically sorted for starting). If omitted, the |
michael@13 | 172 | priority defaults to 500. |
michael@13 | 173 | |
michael@13 | 174 | Output generated on F<stdout> and F<stderr> is captured and normally |
michael@13 | 175 | suppressed. In case the sections script exits with a non-zero return |
michael@13 | 176 | value, the intercepted messages are consolidated, reformatted with a |
michael@13 | 177 | surrounding ASCII-art border and printed to F<stderr>. If the section |
michael@13 | 178 | is tagged with option B<-o>, F<stdout> messages are passed through |
michael@13 | 179 | verbatim, even if the section script exists with a zero return value. |
michael@13 | 180 | |
michael@13 | 181 | =over 4 |
michael@13 | 182 | |
michael@13 | 183 | =item C<%start> [B<-u> I<user>] [B<-p> I<priority>] |
michael@13 | 184 | |
michael@13 | 185 | This section should start daemons or initialize components. |
michael@13 | 186 | It is especially executed by B<OpenPKG> during system startup. |
michael@13 | 187 | |
michael@13 | 188 | =item C<%stop> [B<-u> I<user>] [B<-p> I<priority>] |
michael@13 | 189 | |
michael@13 | 190 | This section should stop daemons or cleaning up components. It is |
michael@13 | 191 | especially executed by B<OpenPKG> during system shutdown and package |
michael@13 | 192 | deinstallation. |
michael@13 | 193 | |
michael@13 | 194 | =item C<%restart> [B<-u> I<user>] [B<-p> I<priority>] |
michael@13 | 195 | |
michael@13 | 196 | This section should restart daemons. |
michael@13 | 197 | It is especially executed by B<OpenPKG> during package upgrades. |
michael@13 | 198 | |
michael@13 | 199 | =item C<%status -o> [B<-u> I<user>] [B<-p> I<priority>] |
michael@13 | 200 | |
michael@13 | 201 | This section has to provide status information for a package |
michael@13 | 202 | by printing to C<stdout> (hence the B<-o> option is always required), |
michael@13 | 203 | in Bourne-Shell syntax, the definition of three variables: |
michael@13 | 204 | |
michael@13 | 205 | =over 4 |
michael@13 | 206 | |
michael@13 | 207 | =item I<package>C<_enable> |
michael@13 | 208 | |
michael@13 | 209 | Whether package is enabled, i.e., whether it accepts run-commands. This |
michael@13 | 210 | variable just has to be printed, because is already set in current |
michael@13 | 211 | script environment. |
michael@13 | 212 | |
michael@13 | 213 | =item I<package>C<_usable> |
michael@13 | 214 | |
michael@13 | 215 | Whether package is usable, i.e., whether it is already correctly |
michael@13 | 216 | configured, etc. This variable has to be individually determined. |
michael@13 | 217 | |
michael@13 | 218 | =item I<package>C<_active> |
michael@13 | 219 | |
michael@13 | 220 | Whether package is active, i.e., whether it is already running. |
michael@13 | 221 | This variable has to be individually determined. |
michael@13 | 222 | |
michael@13 | 223 | =back |
michael@13 | 224 | |
michael@13 | 225 | =item C<%monthly> [B<-u> I<user>] [B<-p> I<priority>] |
michael@13 | 226 | |
michael@13 | 227 | =item C<%weekly> [B<-u> I<user>] [B<-p> I<priority>] |
michael@13 | 228 | |
michael@13 | 229 | =item C<%hourly> [B<-u> I<user>] [B<-p> I<priority>] |
michael@13 | 230 | |
michael@13 | 231 | =item C<%quarterly> [B<-u> I<user>] [B<-p> I<priority>] |
michael@13 | 232 | |
michael@13 | 233 | These sections should perform periodical tasks for a package and |
michael@13 | 234 | are executed on a monthly, weekly, hourly or quarterly basis. |
michael@13 | 235 | |
michael@13 | 236 | =item C<%env> |
michael@13 | 237 | |
michael@13 | 238 | This section is intended to export one or more environment variables |
michael@13 | 239 | which are imported into the shell environment of the caller through the |
michael@13 | 240 | B<--eval> command line option. |
michael@13 | 241 | |
michael@13 | 242 | =back |
michael@13 | 243 | |
michael@13 | 244 | =item B<Custom Sections> |
michael@13 | 245 | |
michael@13 | 246 | All other sections are custom ones and can be fully individual to each |
michael@13 | 247 | package. Some often seen sections are C<%reload> (just reload the |
michael@13 | 248 | configuration without full stop and start procedure), C<%info> (output |
michael@13 | 249 | arbitrary information about package), etc. |
michael@13 | 250 | |
michael@13 | 251 | =back |
michael@13 | 252 | |
michael@13 | 253 | =head2 RUN-COMMAND CONFIGURATION (C<@l_prefix@/bin/openpkg rc.conf>) |
michael@13 | 254 | |
michael@13 | 255 | The run-command configuration variables defined in the "C<%config>" |
michael@13 | 256 | sections of all installed packages can be overridden by the |
michael@13 | 257 | administrator in the global file C<@l_prefix@/bin/openpkg rc.conf>. This file is |
michael@13 | 258 | usually empty, but can be filled with Bourne-Shell compatible variable |
michael@13 | 259 | assignment statements like "I<package>C<_>I<variable>=I<value>". |
michael@13 | 260 | |
michael@13 | 261 | =head2 RUN-COMMAND FUNCTIONS (C<@l_prefix@/bin/openpkg rc.func>) |
michael@13 | 262 | |
michael@13 | 263 | The file C<@l_prefix@/bin/openpkg rc.func> is prepended to the scripts of all |
michael@13 | 264 | executed run-command sections and provides reusable functions. |
michael@13 | 265 | Currently the following functions are defined: |
michael@13 | 266 | |
michael@13 | 267 | =over 4 |
michael@13 | 268 | |
michael@13 | 269 | =item B<rcMsg> [B<-e>] [B<-w>] I<message> |
michael@13 | 270 | |
michael@13 | 271 | Print a message to the output device of the run-command caller. The |
michael@13 | 272 | message is printed to the captured F<stderr> (but are visible to |
michael@13 | 273 | the caller of the run-command script only if the script fails). All |
michael@13 | 274 | messages are prefixed with "C<rc:>". If option B<-e> is given, the |
michael@13 | 275 | prefix is "C<rc:ERROR:>". If option B<-w> is given, the prefix is |
michael@13 | 276 | "C<rc:WARNING:>". |
michael@13 | 277 | |
michael@13 | 278 | =item B<rcPath> [B<-a>] [B<-r>] [B<-p>] [B<-e>] I<variable> I<dir> [I<dir> ...] |
michael@13 | 279 | |
michael@13 | 280 | Add (option B<-a>) or remove (option B<-r>) one or more I<dir>ectories |
michael@13 | 281 | to/from the colon-separated value of a I<var>able. By default, on |
michael@13 | 282 | addition, the directory is appended to the end, if option B<-p> is used |
michael@13 | 283 | the directory is prepended to the start. If option B<-e> is used, the |
michael@13 | 284 | directories are added only if they exist on the underlying filesystem. |
michael@13 | 285 | Use this function for conveniently manipulating C<PATH>, C<MANPATH>, |
michael@13 | 286 | C<INFOPATH>, C<LD_LIBRARY_PATH> and similar variables. |
michael@13 | 287 | |
michael@13 | 288 | =item B<rcTmp> [B<-i>] [B<-f>] [B<-n> I<name>] [B<-k>] |
michael@13 | 289 | |
michael@13 | 290 | Convenience interface to secure temporary file handling. Option B<-i> |
michael@13 | 291 | first has to be used to initialize a secure temporary directory (option |
michael@13 | 292 | B<-k> later will kill this again). Under option B<-f> you then can get |
michael@13 | 293 | reasonable temporary filenames under the created temporary directory. By |
michael@13 | 294 | default, the temporary filename is just "C<tmp>", but can be specified |
michael@13 | 295 | with option B<-n> to be I<name>. |
michael@13 | 296 | |
michael@13 | 297 | =item B<rcService> I<package> I<status> I<value> |
michael@13 | 298 | |
michael@13 | 299 | Convenience interface to checking the C<%status> variables |
michael@13 | 300 | I<package>C<_>I<status> which have to be provided by the C<%config> (if |
michael@13 | 301 | I<status> is "C<enable>" this is enough) and C<%status> (if I<status> is |
michael@13 | 302 | "C<enable>", "C<usable>" and "C<active>"). The B<rcService> especially |
michael@13 | 303 | caches the resolving of the variable values. Returns 0 if the resolved |
michael@13 | 304 | value is I<value>, else returns 1. |
michael@13 | 305 | |
michael@13 | 306 | =item B<rcVarIsYes> I<name> |
michael@13 | 307 | |
michael@13 | 308 | Checks whether variable I<name> has a value of "C<yes>", "C<true>", |
michael@13 | 309 | "C<on>", or "C<1>" (with arbitrary lower or upper case letters). Returns |
michael@13 | 310 | 0 if value is one of these positive ones, else returns 1. |
michael@13 | 311 | |
michael@13 | 312 | =back |
michael@13 | 313 | |
michael@13 | 314 | =head1 EXAMPLES |
michael@13 | 315 | |
michael@13 | 316 | First, an example run-command script C<@l_prefix@/bin/openpkg rc.d/rc.foo> for a |
michael@13 | 317 | fictional daemon package "C<foo>": |
michael@13 | 318 | |
michael@13 | 319 | %config |
michael@13 | 320 | foo_enable="${openpkg_rc_def}" |
michael@13 | 321 | foo_listen="127.0.0.1" |
michael@13 | 322 | foo_log_prolog="true" |
michael@13 | 323 | foo_log_epilog="true" |
michael@13 | 324 | foo_log_numfiles="10" |
michael@13 | 325 | foo_log_minsize="1M" |
michael@13 | 326 | foo_log_complevel="9" |
michael@13 | 327 | |
michael@13 | 328 | %common |
michael@13 | 329 | foo_homedir="@l_prefix@/share/foo" |
michael@13 | 330 | foo_cfgfile="@l_prefix@/etc/foo/foo.cfg" |
michael@13 | 331 | foo_pidfile="@l_prefix@/var/foo/foo.pid" |
michael@13 | 332 | foo_logfile="@l_prefix@/var/foo/foo.log" |
michael@13 | 333 | foo_signal () { |
michael@13 | 334 | if [ -f ${foo_pidfile} ]; then |
michael@13 | 335 | kill -$1 `cat ${foo_pidfile}` |
michael@13 | 336 | return $? |
michael@13 | 337 | else |
michael@13 | 338 | return 1 |
michael@13 | 339 | fi |
michael@13 | 340 | } |
michael@13 | 341 | |
michael@13 | 342 | %status |
michael@13 | 343 | foo_usable="no" |
michael@13 | 344 | if [ ".`grep '<<PASSWORD>>' ${foo_cfgfile}`" = . ]; then |
michael@13 | 345 | foo_usable="yes" |
michael@13 | 346 | fi |
michael@13 | 347 | foo_active="no" |
michael@13 | 348 | if [ -f ${foo_pidfile} ]; then |
michael@13 | 349 | foo_signal 0 |
michael@13 | 350 | if [ $? -eq 0 ]; then |
michael@13 | 351 | foo_active="yes" |
michael@13 | 352 | fi |
michael@13 | 353 | fi |
michael@13 | 354 | echo "foo_enable=${foo_enable}" |
michael@13 | 355 | echo "foo_usable=${foo_usable}" |
michael@13 | 356 | echo "foo_active=${foo_active}" |
michael@13 | 357 | |
michael@13 | 358 | %start |
michael@13 | 359 | rcService foo enable yes || exit 0 |
michael@13 | 360 | rcService foo active yes && exit 0 |
michael@13 | 361 | @l_prefix@/sbin/foo --listen ${foo_listen} |
michael@13 | 362 | |
michael@13 | 363 | %stop |
michael@13 | 364 | rcService foo enable yes || exit 0 |
michael@13 | 365 | rcService foo active yes || exit 0 |
michael@13 | 366 | foo_signal TERM |
michael@13 | 367 | |
michael@13 | 368 | %restart |
michael@13 | 369 | rcService foo enable yes || exit 0 |
michael@13 | 370 | rcService foo active yes || exit 0 |
michael@13 | 371 | rc foo stop start |
michael@13 | 372 | |
michael@13 | 373 | %daily |
michael@13 | 374 | rcService foo enable yes || exit 0 |
michael@13 | 375 | shtool rotate -f \ |
michael@13 | 376 | -n ${foo_log_numfiles} -s ${foo_log_minsize} -d \ |
michael@13 | 377 | -z ${foo_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \ |
michael@13 | 378 | -P "${foo_log_prolog}" -E "${foo_log_epilog}" \ |
michael@13 | 379 | ${foo_logfile} |
michael@13 | 380 | |
michael@13 | 381 | %env |
michael@13 | 382 | if rcService foo enable yes; then |
michael@13 | 383 | FOO_HOME="$foo_homedir" |
michael@13 | 384 | export FOO_HOME |
michael@13 | 385 | fi |
michael@13 | 386 | |
michael@13 | 387 | Now, show all run-command configuration variables, their |
michael@13 | 388 | default values and their effective values of package "C<foo>": |
michael@13 | 389 | |
michael@13 | 390 | $ @l_prefix@/bin/openpkg rc --config | grep "^foo_" |
michael@13 | 391 | |
michael@13 | 392 | Override the default value of a run-command configuration |
michael@13 | 393 | variable C<foo_listen>: |
michael@13 | 394 | |
michael@13 | 395 | $ echo 'foo_listen="192.168.0.1"' >>@l_prefix@/bin/openpkg rc.conf |
michael@13 | 396 | |
michael@13 | 397 | Stop and start from scratch the package "C<foo>": |
michael@13 | 398 | |
michael@13 | 399 | $ @l_prefix@/bin/openpkg rc foo stop start |
michael@13 | 400 | |
michael@13 | 401 | Query the effective value of run-command configuration |
michael@13 | 402 | variable C<foo_enable> in a script: |
michael@13 | 403 | |
michael@13 | 404 | if [ ".`@l_prefix@/bin/openpkg rc -q foo_enable`" = .yes ]; then ... |
michael@13 | 405 | |
michael@13 | 406 | Import all environment settings from all (including "C<foo>") installed |
michael@13 | 407 | packages into the current Bourne-Shell environment: |
michael@13 | 408 | |
michael@13 | 409 | $ eval `@l_prefix@/bin/openpkg rc --eval all env` |
michael@13 | 410 | $ echo $FOO_HOME |
michael@13 | 411 | |
michael@13 | 412 | =head1 SEE ALSO |
michael@13 | 413 | |
michael@13 | 414 | B<OpenPKG> http://www.openpkg.org/ |
michael@13 | 415 | |
michael@13 | 416 | =head1 HISTORY |
michael@13 | 417 | |
michael@13 | 418 | The B<OpenPKG> run-command facility consisting of the scripts C<rc> |
michael@13 | 419 | and C<rc.func> were originally invented in November 2000 by Ralf S. |
michael@13 | 420 | Engelschall for B<OpenPKG>. They were completely worked off from scratch |
michael@13 | 421 | in July 2003 for B<OpenPKG 1.3>. |
michael@13 | 422 | |
michael@13 | 423 | =head1 AUTHOR |
michael@13 | 424 | |
michael@13 | 425 | Ralf S. Engelschall |
michael@13 | 426 | rse@engelschall.com |
michael@13 | 427 | www.engelschall.com |
michael@13 | 428 | |
michael@13 | 429 | =cut |
michael@13 | 430 |