ch_rc(1M) ch_rc(1M)
NAME [Toc] [Back]
ch_rc - change system configuration file
SYNOPSIS [Toc] [Back]
/usr/sbin/ch_rc -a|-r|-l [-v] [-A] [-R root] [-p
{parameter|parameter=value}...] [file...]
DESCRIPTION [Toc] [Back]
ch_rc manages the addition, modification, removal, and retrieval of
information stored in files having the format of those in the
/etc/rc.config.d directory.
Parameter names are treated as strings. Thus, X[0] has no special
meaning to ch_rc in relation to other parameters named X[1] or X.
Options [Toc] [Back]
file Specify the file(s) to be used as the configuration
database. If no file is specified, the set of files
used by ch_rc defaults to /etc/TIMEZONE and all files
in the /etc/rc.config.d directory.
Modification and deletion of configuration parameters
occurs in the file where the parameter is found.
-a Add or modify a parameter definition. For each
parameter specified on the command line, if the
parameter is found in the specified (or default) files,
it is modified to reflect the specified value. If the
parameter is not found, it is added to the specified
file(s).
If a new parameter is being defined, one or more files
must be specified on the command line; the specified
files are those in which the parameter will be defined.
-r Remove a parameter definition. For each parameter name
specified on the command line, remove any occurrence of
that parameter from the specified file(s).
-l List configuration values. For each parameter specified
on the command line, output every definition of the
parameter from the specified file(s). Output consists
of only the values, one per line.
-p Specify a parameter name or name/value pair. If a name
and value is expected, but only a name is specified,
the value will be set to the empty string. For
example, specifying FOO or FOO= will result in FOO and
FOO= respectively.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: Sep 2004
ch_rc(1M) ch_rc(1M)
Due to shell quoting rules, if you need a quoted
parameter value, you must protect the quotes from the
shell. For example,
ch_rc -a -p VALUE="a b c" <file>
yields:
VALUE=a b c
which is an error, whereas,
ch_rc -a -p VALUE='"a b c"' <file>
yields:
VALUE="a b c"
-v Verbose. When used with the -l option, the -v option
causes a verbose listing to be output. This listing
includes a filename followed by the entire line
containing the specified parameter for each occurrence
of the parameter.
-A The -A option is used to list all occurrences of array
parameters matching the parameters specified on the
command line.
For example,
ch_rc -l -A -v -p ZZZ file
may emit the following output:
file: ZZZ[0]=zero
file: ZZZ[5]=five
file: ZZZ[9]=fred
-R root Normally, the files specified on the command line are
used as specified. By specifying a root directory with
the -R option, all files (including the default files
if none are specified) will be interpreted relative to
root.
For example, if root is specified as /foo and
/etc/TIMEZONE is specified on the command line, it will
be interpreted as /foo/etc/TIMEZONE.
RETURN VALUE [Toc] [Back]
ch_rc exits with one of the following values:
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: Sep 2004
ch_rc(1M) ch_rc(1M)
0 add/delete/list successful
1 command line syntax/usage error
2 can not access one or more of the listed (or default) files
3 can not open/create/write file
4 memory error
5 no files specified on command line for add option
EXAMPLES [Toc] [Back]
Files in the /etc/rc.config.d directory have the following format:
# Comments are preceded by pound signs and
# are always on a line of their own.
# Blank lines are allowed.
VARIABLE=value
VARIABLE_2=value2
VARIABLE_3[1]=value3
VARIABLE_3[2]=value4
# All parameters are defined on a single line
# Parameters must not be exported
WARNINGS [Toc] [Back]
ch_rc does not interpret configuration files; it only does pattern
matching. As a result, if comments appear on lines containing
parameter definitions, the comments will also appear in output when
using the -l option.
ch_rc cannot parse multiple parameter definitions which occur on the
same line of a file. Also, only certain formats are supported and
whole lines are replaced.
Parameters must not be exported. If the parameters are exported, only
the parameter value (name=value) pair is stored and the rest of the
data like an export special command in front of a name value pair,
whitespace, and comments are deleted from the line.
AUTHOR [Toc] [Back]
ch_rc was developed by HP.
FILES [Toc] [Back]
/etc/rc.config system configuration database driver file
/etc/rc.config.d directory containing system configuration
files
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: Sep 2004
ch_rc(1M) ch_rc(1M)
SEE ALSO [Toc] [Back]
rc.config(4).
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: Sep 2004 [ Back ] |