xref: /freebsd/usr.sbin/sysrc/sysrc.8 (revision 613d7da7d5dc56121ae796ad85f524029a940540)
1*613d7da7SDevin Teske.\" Copyright (c) 2011-2016 Devin Teske
22a357efaSDevin Teske.\" All rights reserved.
32a357efaSDevin Teske.\"
42a357efaSDevin Teske.\" Redistribution and use in source and binary forms, with or without
52a357efaSDevin Teske.\" modification, are permitted provided that the following conditions
62a357efaSDevin Teske.\" are met:
72a357efaSDevin Teske.\" 1. Redistributions of source code must retain the above copyright
82a357efaSDevin Teske.\"    notice, this list of conditions and the following disclaimer.
92a357efaSDevin Teske.\" 2. Redistributions in binary form must reproduce the above copyright
102a357efaSDevin Teske.\"    notice, this list of conditions and the following disclaimer in the
112a357efaSDevin Teske.\"    documentation and/or other materials provided with the distribution.
122a357efaSDevin Teske.\"
132a357efaSDevin Teske.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
142a357efaSDevin Teske.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
152a357efaSDevin Teske.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
162a357efaSDevin Teske.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
172a357efaSDevin Teske.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
182a357efaSDevin Teske.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
192a357efaSDevin Teske.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
202a357efaSDevin Teske.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
212a357efaSDevin Teske.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
222a357efaSDevin Teske.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
232a357efaSDevin Teske.\" SUCH DAMAGE.
242a357efaSDevin Teske.\"
252a357efaSDevin Teske.\" $FreeBSD$
262a357efaSDevin Teske.\"
27*613d7da7SDevin Teske.Dd February 2, 2016
282a357efaSDevin Teske.Dt SYSRC 8
292a357efaSDevin Teske.Os
302a357efaSDevin Teske.Sh NAME
312a357efaSDevin Teske.Nm sysrc
322a357efaSDevin Teske.Nd safely edit system rc files
332a357efaSDevin Teske.Sh SYNOPSIS
342a357efaSDevin Teske.Nm
354fb1de43SDevin Teske.Op Fl cdDeEFhinNqvx
364fb1de43SDevin Teske.Op Fl s Ar name
372a357efaSDevin Teske.Op Fl f Ar file
382a357efaSDevin Teske.Op Fl j Ar jail | Fl R Ar dir
393a40fd5eSDevin Teske.Ar name Ns Op Ns Oo +|- Oc Ns = Ns Ar value
402a357efaSDevin Teske.Ar ...
412a357efaSDevin Teske.Nm
424fb1de43SDevin Teske.Op Fl cdDeEFhinNqvx
434fb1de43SDevin Teske.Op Fl s Ar name
442a357efaSDevin Teske.Op Fl f Ar file
452a357efaSDevin Teske.Op Fl j Ar jail | Fl R Ar dir
462a357efaSDevin Teske.Fl a | A
474fb1de43SDevin Teske.Nm
484fb1de43SDevin Teske.Op Fl E
494fb1de43SDevin Teske.Op Fl s Ar name
504fb1de43SDevin Teske.Op Fl f Ar file
514fb1de43SDevin Teske.Fl l
524fb1de43SDevin Teske.Nm
534fb1de43SDevin Teske.Op Fl eEqv
544fb1de43SDevin Teske.Fl L
554fb1de43SDevin Teske.Op Ar name ...
562a357efaSDevin Teske.Sh DESCRIPTION
572a357efaSDevin TeskeThe
582a357efaSDevin Teske.Nm
592a357efaSDevin Teskeutility retrieves
602a357efaSDevin Teske.Xr rc.conf 5
612a357efaSDevin Teskevariables from the collection of system rc files and allows processes with
622a357efaSDevin Teskeappropriate privilege to change values in a safe and effective manner.
632a357efaSDevin Teske.Pp
642a357efaSDevin TeskeThe following options are available:
652a357efaSDevin Teske.Bl -tag -width indent+
662a357efaSDevin Teske.It Fl a
672a357efaSDevin TeskeDump a list of all non-default configuration variables.
682a357efaSDevin Teske.It Fl A
692a357efaSDevin TeskeDump a list of all configuration variables
702a357efaSDevin Teske.Pq incl. defaults .
714cc57221SDevin Teske.It Fl c
72e6c03065SDevin TeskeCheck only.
73e6c03065SDevin TeskeFor querying, return success if all requested variables are set
74e6c03065SDevin Teske.Pq even if NULL ,
75e6c03065SDevin Teskeotherwise return error status.
76e6c03065SDevin TeskeFor assignments, return success if no changes are required, otherwise failure.
774cc57221SDevin TeskeIf verbose
784cc57221SDevin Teske.Pq see Dq Fl v
79e6c03065SDevin Teskeprints a message stating whether variables are set and/or changes are required.
802a357efaSDevin Teske.It Fl d
812a357efaSDevin TeskePrint a description of the given variable.
822a357efaSDevin Teske.It Fl D
832a357efaSDevin TeskeShow default value(s) only (this is the same as setting RC_CONFS to NULL or
842a357efaSDevin Teskepassing `-f' with a NULL file-argument).
852a357efaSDevin Teske.It Fl e
862a357efaSDevin TeskePrint query results as
87379cb6baSDevin Teske.Xr sh 1
88379cb6baSDevin Teskecompatible syntax
89379cb6baSDevin Teske.Pq for example, Ql var=value .
90379cb6baSDevin TeskeIgnored if either
91379cb6baSDevin Teske.Ql Fl n
92379cb6baSDevin Teskeor
93379cb6baSDevin Teske.Ql Fl F
942a357efaSDevin Teskeis specified.
954fb1de43SDevin Teske.It Fl E
964fb1de43SDevin TeskeWhen given
974fb1de43SDevin Teske.Sq Fl l
984fb1de43SDevin Teskeor
994fb1de43SDevin Teske.Sq Fl L
1004fb1de43SDevin Tesketo list configuration files, only list those that exist.
1014fb1de43SDevin TeskeWhen changing a setting, prefer to modify existing files.
1022a357efaSDevin Teske.It Fl f Ar file
1032a357efaSDevin TeskeOperate on the specified file(s) instead of the files obtained by reading the
1042a357efaSDevin Teske.Sq rc_conf_files
1052a357efaSDevin Teskeentry in the
1062a357efaSDevin Teske.Ev RC_DEFAULTS
1072a357efaSDevin Teskefile.
1082a357efaSDevin TeskeThis option can be specified multiple times for additional files.
1092a357efaSDevin Teske.It Fl F
1102a357efaSDevin TeskeShow only the last
1112a357efaSDevin Teske.Xr rc.conf 5
1122a357efaSDevin Teskefile each directive is in.
1132a357efaSDevin Teske.It Fl h
1142a357efaSDevin TeskePrint a short usage message to stderr and exit.
1152a357efaSDevin Teske.It Fl -help
1162a357efaSDevin TeskePrint a full usage statement to stderr and exit.
1172a357efaSDevin Teske.It Fl i
1182a357efaSDevin TeskeIgnore unknown variables.
1192a357efaSDevin Teske.It Fl j Ar jail
1202a357efaSDevin TeskeThe
1212a357efaSDevin Teske.Ar jid
1222a357efaSDevin Teskeor name of the
1232a357efaSDevin Teske.Ar jail
1242a357efaSDevin Tesketo operate within
1252a357efaSDevin Teske.Pq overrides So Fl R Ar dir Sc ; requires Xr jexec 8 .
1264fb1de43SDevin Teske.It Fl l
1274fb1de43SDevin TeskeList configuration files used at startup on stdout and exit.
1284fb1de43SDevin Teske.It Fl L
1294fb1de43SDevin TeskeList all configuration files including rc.conf.d entries on stdout and exit.
1304fb1de43SDevin TeskeCan be combined with
1314fb1de43SDevin Teske.Sq Fl v
1324fb1de43SDevin Teskeor
1334fb1de43SDevin Teske.Sq Fl e
1344fb1de43SDevin Tesketo show service names.
1354fb1de43SDevin Teske.Nm
1364fb1de43SDevin Teskeexits with success if all named services are installed, failure otherwise.
1372a357efaSDevin Teske.It Fl n
1382a357efaSDevin TeskeShow only variable values, not their names.
1392a357efaSDevin Teske.It Fl N
1402a357efaSDevin TeskeShow only variable names, not their values.
1412a357efaSDevin Teske.It Fl q
1423dacd67eSJoel DahlQuiet.
143e6c03065SDevin TeskeDisable verbose and hide certain errors.
1444fb1de43SDevin TeskeWhen combined with
1454fb1de43SDevin Teske.Sq Fl L
1464fb1de43SDevin Teskeand one or more
1474fb1de43SDevin Teske.Li Ar name
1484fb1de43SDevin Teskearguments, provide only exit status and no output.
1492a357efaSDevin Teske.It Fl R Ar dir
1502a357efaSDevin TeskeOperate within the root directory
151e6c03065SDevin Teske.Sq Ar dir
1522a357efaSDevin Teskerather than
153e6c03065SDevin Teske.Sq / .
1544fb1de43SDevin Teske.It Fl s Ar name
1554fb1de43SDevin TeskeIf an
1564fb1de43SDevin Teske.Li rc.d
1574fb1de43SDevin Teskescript of
1584fb1de43SDevin Teske.Ar name
1594fb1de43SDevin Teskeexists
1604fb1de43SDevin Teske.Po
1614fb1de43SDevin Teskein
1624fb1de43SDevin Teske.Dq /etc/rc.d
1634fb1de43SDevin Teskeor
1644fb1de43SDevin Teske.Li local_startup
1654fb1de43SDevin Teskedirectories
1664fb1de43SDevin Teske.Pc ,
1674fb1de43SDevin Teskeprocess its
1684fb1de43SDevin Teske.Dq rc.conf.d
1694fb1de43SDevin Teskeentries as potential overrides to
1704fb1de43SDevin Teske.Sq rc_conf_files .
1714fb1de43SDevin TeskeSee
1724fb1de43SDevin Teske.Xr rc.subr 8
1734fb1de43SDevin Teskefor additional information on
1744fb1de43SDevin Teske.Dq rc.conf.d .
1754fb1de43SDevin TeskeCan be combined with
1764fb1de43SDevin Teske.Sq Fl l
1774fb1de43SDevin Tesketo list configuration files used by service at startup.
1782a357efaSDevin Teske.It Fl v
1793dacd67eSJoel DahlVerbose.
1803dacd67eSJoel DahlPrint the pathname of the specific
1812a357efaSDevin Teske.Xr rc.conf 5
1822a357efaSDevin Teskefile where the directive was found.
1833e74984cSDevin Teske.It Fl -version
1843e74984cSDevin TeskePrint version information to stdout and exit.
1852a357efaSDevin Teske.It Fl x
1862a357efaSDevin TeskeRemove variable(s) from specified file(s).
1872a357efaSDevin Teske.El
1882a357efaSDevin Teske.Pp
189e6c03065SDevin TeskeThis utility has a similar syntax to
1902a357efaSDevin Teske.Xr sysctl 8 .
1912a357efaSDevin TeskeIt shares the `-e' and `-n' options
1922a357efaSDevin Teske.Pq detailed above
1932a357efaSDevin Teskeand also has the same
1942a357efaSDevin Teske.Ql name[=value]
195e6c03065SDevin Teskesyntax for making queries/assignments.
196a7bdf21cSDevin TeskeIn addition
1973a40fd5eSDevin Teske.Pq but unlike Xr sysctl 8 ,
198a7bdf21cSDevin Teske.Ql name+=value
1993a40fd5eSDevin Teskeis supported for adding items to values
2003a40fd5eSDevin Teske.Pq see APPENDING VALUES
2013a40fd5eSDevin Teskeand
2023a40fd5eSDevin Teske.Ql name-=value
2033a40fd5eSDevin Teskeis supported for removing items from values
2043a40fd5eSDevin Teske.Pq see SUBTRACTING VALUES .
2052a357efaSDevin Teske.Pp
2062a357efaSDevin TeskeHowever, while
2072a357efaSDevin Teske.Xr sysctl 8
2082a357efaSDevin Teskeserves to query/modify MIBs in the entrant kernel,
209be15d0e4SJoel Dahl.Nm
2102a357efaSDevin Teskeinstead works on values in the system
2112a357efaSDevin Teske.Xr rc.conf 5
2122a357efaSDevin Teskeconfiguration files.
2132a357efaSDevin Teske.Pp
2142a357efaSDevin TeskeThe list of system configuration files is configured in the file
2152a357efaSDevin Teske.Ql /etc/defaults/rc.conf
2162a357efaSDevin Teskewithin the variable
2172a357efaSDevin Teske.Ql rc_conf_files ,
2183dacd67eSJoel Dahlwhich by-default contains a space-separated list of pathnames.
2193dacd67eSJoel DahlOn all FreeBSD
2203dacd67eSJoel Dahlsystems, this defaults to the value "/etc/rc.conf /etc/rc.conf.local".
2213dacd67eSJoel DahlEach
2223dacd67eSJoel Dahlpathname is sourced in-order upon startup.
2233dacd67eSJoel DahlIt is in the same fashion that
2242a357efaSDevin Teske.Nm
2252a357efaSDevin Teskesources the configuration files before returning the value of the given
2262a357efaSDevin Teskevariable.
2272a357efaSDevin Teske.Pp
2282a357efaSDevin TeskeWhen supplied a variable name,
2292a357efaSDevin Teske.Nm
2303dacd67eSJoel Dahlwill return the value of the variable.
2313dacd67eSJoel DahlIf the variable does not appear in any
2322a357efaSDevin Teskeof the configured
2332a357efaSDevin Teske.Ql rc_conf_files ,
2342a357efaSDevin Teskean error is printed and error status is returned.
2352a357efaSDevin Teske.Pp
2362a357efaSDevin TeskeWhen changing values of a given variable, it does not matter if the variable
2372a357efaSDevin Teskeappears in any of the
2382a357efaSDevin Teske.Ql rc_conf_files
2393dacd67eSJoel Dahlor not.
2403dacd67eSJoel DahlIf the variable does not appear in any of the files, it is appended to
2412a357efaSDevin Teskethe end of the first pathname in the
2422a357efaSDevin Teske.Ql rc_conf_files
2433dacd67eSJoel Dahlvariable.
2443dacd67eSJoel DahlOtherwise,
2452a357efaSDevin Teske.Nm
2462a357efaSDevin Teskewill replace only the last-occurrence in the last-file found to contain the
2473dacd67eSJoel Dahlvariable.
2483dacd67eSJoel DahlThis gets the value to take effect next boot without heavily
2492a357efaSDevin Teskemodifying these integral files (yet taking care not to allow the file to
2502a357efaSDevin Teskegrow unwieldy should
2512a357efaSDevin Teske.Nm
2522a357efaSDevin Teskebe called repeatedly).
2533a40fd5eSDevin Teske.Sh APPENDING VALUES
2543a40fd5eSDevin TeskeWhen using the
2553a40fd5eSDevin Teske.Ql key+=value
2563a40fd5eSDevin Teskesyntax to add items to existing values,
2573a40fd5eSDevin Teskethe first character of the value is taken as the delimiter separating items
258*613d7da7SDevin Teske.Pq usually Qo (space) Qc or Qo , Qc .
2593a40fd5eSDevin TeskeFor example, in the following statement:
2608fdb5185SDevin Teske.Bl -item -offset indent
2618fdb5185SDevin Teske.It
2623a40fd5eSDevin Teske.Nm
2633a40fd5eSDevin Teskecloned_interfaces+=" gif0"
2643a40fd5eSDevin Teske.El
2653a40fd5eSDevin Teske.Pp
2663a40fd5eSDevin Teskethe first character is a space, informing
2673a40fd5eSDevin Teske.Nm
2683a40fd5eSDevin Teskethat existing values are to be considered separated by whitespace.
2693a40fd5eSDevin TeskeIf
2703a40fd5eSDevin Teske.Ql gif0
2713a40fd5eSDevin Teskeis not found in the existing value for
2723a40fd5eSDevin Teske.Va cloned_interfaces ,
2733a40fd5eSDevin Teskeit is added
2743a40fd5eSDevin Teske.Pq with delimiter only if existing value is non-NULL .
2753a40fd5eSDevin Teske.Pp
2763a40fd5eSDevin TeskeFor convenience, if the first character is alpha-numeric
2773a40fd5eSDevin Teske.Pq letters A-Z, a-z, or numbers 0-9 ,
2783a40fd5eSDevin Teske.Nm
2793a40fd5eSDevin Teskeuses the default setting of whitespace as separator.
2803a40fd5eSDevin TeskeFor example, the above and below statements are equivalent since
2813a40fd5eSDevin Teske.Dq gif0
2823a40fd5eSDevin Teskestarts with an alpha-numeric character
2833a40fd5eSDevin Teske.Pq the letter Li g :
2848fdb5185SDevin Teske.Bl -item -offset indent
2858fdb5185SDevin Teske.It
2863a40fd5eSDevin Teske.Nm
2873a40fd5eSDevin Teskecloned_interfaces+=gif0
2883a40fd5eSDevin Teske.El
2893a40fd5eSDevin Teske.Pp
2903a40fd5eSDevin TeskeTake the following sequence for example:
2918fdb5185SDevin Teske.Bl -item -offset indent
2928fdb5185SDevin Teske.It
2933a40fd5eSDevin Teske.Nm
2943a40fd5eSDevin Teskecloned_interfaces= # start with NULL
2958fdb5185SDevin Teske.It
2963a40fd5eSDevin Teske.Nm
2973a40fd5eSDevin Teskecloned_interfaces+=gif0
2983a40fd5eSDevin Teske.Dl # NULL -> `gif0' Pq NB: no preceding delimiter
2998fdb5185SDevin Teske.It
3003a40fd5eSDevin Teske.Nm
3013a40fd5eSDevin Teskecloned_interfaces+=gif0 # no change
3028fdb5185SDevin Teske.It
3033a40fd5eSDevin Teske.Nm
3043a40fd5eSDevin Teskecloned_interfaces+="tun0 gif0"
3053a40fd5eSDevin Teske.Dl # `gif0' -> `gif0 tun0' Pq NB: no duplication
3063a40fd5eSDevin Teske.El
3073a40fd5eSDevin Teske.Pp
3083a40fd5eSDevin Teske.Nm
3093a40fd5eSDevin Teskeprevents the same value from being added if already there.
3103a40fd5eSDevin Teske.Sh SUBTRACTING VALUES
3113a40fd5eSDevin TeskeWhen using the
3123a40fd5eSDevin Teske.Ql key-=value
3133a40fd5eSDevin Teskesyntax to remove items from existing values,
3143a40fd5eSDevin Teskethe first character of the value is taken as the delimiter separating items
3153a40fd5eSDevin Teske.Pq usually Qo \  Qc or Qo , Qc .
3163a40fd5eSDevin TeskeFor example, in the following statement:
3173a40fd5eSDevin Teske.Pp
3183a40fd5eSDevin Teske.Dl Nm cloned_interfaces-=" gif0"
3193a40fd5eSDevin Teske.Pp
3203a40fd5eSDevin Teskethe first character is a space, informing
3213a40fd5eSDevin Teske.Nm
3223a40fd5eSDevin Teskethat existing values are to be considered separated by whitespace.
3233a40fd5eSDevin TeskeIf
3243a40fd5eSDevin Teske.Ql gif0
3253a40fd5eSDevin Teskeis found in the existing value for
3263a40fd5eSDevin Teske.Va cloned_interfaces ,
3273a40fd5eSDevin Teskeit is removed
3283a40fd5eSDevin Teske.Pq extra delimiters removed .
3293a40fd5eSDevin Teske.Pp
3303a40fd5eSDevin TeskeFor convenience, if the first character is alpha-numeric
3313a40fd5eSDevin Teske.Pq letters A-Z, a-z, or numbers 0-9 ,
3323a40fd5eSDevin Teske.Nm
3333a40fd5eSDevin Teskeuses the default setting of whitespace as separator.
3343a40fd5eSDevin TeskeFor example, the above and below statements are equivalent since
3353a40fd5eSDevin Teske.Dq gif0
3363a40fd5eSDevin Teskestarts with an alpha-numeric character
3373a40fd5eSDevin Teske.Pq the letter Li g :
3388fdb5185SDevin Teske.Bl -item -offset indent
3398fdb5185SDevin Teske.It
3403a40fd5eSDevin Teske.Nm
3413a40fd5eSDevin Teskecloned_interfaces-=gif0
3423a40fd5eSDevin Teske.El
3433a40fd5eSDevin Teske.Pp
3443a40fd5eSDevin TeskeTake the following sequence for example:
3458fdb5185SDevin Teske.Bl -item -offset indent
3468fdb5185SDevin Teske.It
3473a40fd5eSDevin Teske.Nm
3483a40fd5eSDevin Teskefoo="bar baz" # start
3498fdb5185SDevin Teske.It
3503a40fd5eSDevin Teske.Nm
3513a40fd5eSDevin Teskefoo-=bar # `bar baz' -> `baz'
3528fdb5185SDevin Teske.It
3533a40fd5eSDevin Teske.Nm
3543a40fd5eSDevin Teskefoo-=baz # `baz' -> NULL
3553a40fd5eSDevin Teske.El
3563a40fd5eSDevin Teske.Pp
3573a40fd5eSDevin Teske.Nm
3583a40fd5eSDevin Teskeremoves all occurrences of all items provided
3593a40fd5eSDevin Teskeand collapses extra delimiters between items.
3602a357efaSDevin Teske.Sh ENVIRONMENT
3612a357efaSDevin TeskeThe following environment variables are referenced by
3622a357efaSDevin Teske.Nm :
363bc3ccb90SDevin Teske.Bl -tag -width ".Ev RC_DEFAULTS"
3642a357efaSDevin Teske.It Ev RC_CONFS
3652a357efaSDevin TeskeOverride default
3662a357efaSDevin Teske.Ql rc_conf_files
3672a357efaSDevin Teske.Pq even if set to NULL .
3682a357efaSDevin Teske.It Ev RC_DEFAULTS
3692a357efaSDevin TeskeLocation of
3702a357efaSDevin Teske.Ql /etc/defaults/rc.conf
3712a357efaSDevin Teskefile.
3722a357efaSDevin Teske.El
3732a357efaSDevin Teske.Sh DEPENDENCIES
3742a357efaSDevin TeskeThe following standard commands are required by
3752a357efaSDevin Teske.Nm :
3762a357efaSDevin Teske.Pp
3772a357efaSDevin Teske.Xr awk 1 ,
3782a357efaSDevin Teske.Xr cat 1 ,
3792a357efaSDevin Teske.Xr chmod 1 ,
3802a357efaSDevin Teske.Xr env 1 ,
3812a357efaSDevin Teske.Xr grep 1 ,
3822a357efaSDevin Teske.Xr jls 1 ,
3832a357efaSDevin Teske.Xr mktemp 1 ,
3842a357efaSDevin Teske.Xr mv 1 ,
3852a357efaSDevin Teske.Xr rm 1 ,
3862a357efaSDevin Teske.Xr sh 1 ,
3872a357efaSDevin Teske.Xr stat 1 ,
388872d9e39SNiclas Zeising.Xr tail 1 ,
389872d9e39SNiclas Zeising.Xr chown 8
390872d9e39SNiclas Zeisingand
391872d9e39SNiclas Zeising.Xr jexec 8 .
3922a357efaSDevin Teske.Sh FILES
3932a357efaSDevin Teske.Bl -tag -width ".Pa /etc/defaults/rc.conf" -compact
3942a357efaSDevin Teske.It Pa /etc/defaults/rc.conf
3952a357efaSDevin Teske.It Pa /etc/rc.conf
3962a357efaSDevin Teske.It Pa /etc/rc.conf.local
3974fb1de43SDevin Teske.It Pa /etc/rc.conf.d/name
3984fb1de43SDevin Teske.It Pa /etc/rc.conf.d/name/*
3994fb1de43SDevin Teske.It Pa /usr/local/etc/rc.conf.d/name
4004fb1de43SDevin Teske.It Pa /usr/local/etc/rc.conf.d/name/*
4012a357efaSDevin Teske.El
4022a357efaSDevin Teske.Sh EXAMPLES
4032a357efaSDevin TeskeBelow are some simple examples of how
4042a357efaSDevin Teske.Nm
4052a357efaSDevin Teskecan be used to query certain values from the
4062a357efaSDevin Teske.Xr rc.conf 5
4072a357efaSDevin Teskecollection of system configuration files:
4082a357efaSDevin Teske.Pp
4092a357efaSDevin Teske.Nm
4102a357efaSDevin Teskesshd_enable
4112a357efaSDevin Teske.Dl returns the value of $sshd_enable, usually YES or NO .
4122a357efaSDevin Teske.Pp
4132a357efaSDevin Teske.Nm
4142a357efaSDevin Teskedefaultrouter
4152a357efaSDevin Teske.Dl returns IP address of default router Pq if configured .
4162a357efaSDevin Teske.Pp
4172a357efaSDevin TeskeWorking on other files, such as
4182a357efaSDevin Teske.Xr crontab 5 :
4192a357efaSDevin Teske.Pp
4202a357efaSDevin Teske.Nm
4212a357efaSDevin Teske-f /etc/crontab MAILTO
4222a357efaSDevin Teske.Dl returns the value of the MAILTO setting Pq if configured .
4232a357efaSDevin Teske.Pp
424e8f6aafbSDevin TeskeAppending to existing values:
425e8f6aafbSDevin Teske.Pp
426e8f6aafbSDevin Teske.Nm
4273a40fd5eSDevin Teske\&cloned_interfaces+=gif0
4283a40fd5eSDevin Teske.Dl appends Qo gif0 Qc to $cloned_interfaces Pq see APPENDING VALUES .
4293a40fd5eSDevin Teske.Pp
4303a40fd5eSDevin Teske.Nm
4313a40fd5eSDevin Teske\&cloned_interfaces-=gif0
4323a40fd5eSDevin Teske.Dl removes Qo gif0 Qc from $cloned_interfaces Pq see SUBTRACTING VALUES .
433e8f6aafbSDevin Teske.Pp
4342a357efaSDevin TeskeIn addition to the above syntax,
4352a357efaSDevin Teske.Nm
4362a357efaSDevin Teskealso supports inline
4372a357efaSDevin Teske.Xr sh 1
4382a357efaSDevin TeskePARAMETER expansion for changing the way values are reported, shown below:
4392a357efaSDevin Teske.Pp
4402a357efaSDevin Teske.Nm
4412a357efaSDevin Teske\&'hostname%%.*'
4422a357efaSDevin Teske.Dl returns $hostname up to (but not including) first `.' .
4432a357efaSDevin Teske.Pp
4442a357efaSDevin Teske.Nm
4452a357efaSDevin Teske\&'network_interfaces%%[$IFS]*'
4462a357efaSDevin Teske.Dl returns first word of $network_interfaces .
4472a357efaSDevin Teske.Pp
4482a357efaSDevin Teske.Nm
4492a357efaSDevin Teske\&'ntpdate_flags##*[$IFS]'
4502a357efaSDevin Teske.Dl returns last word of $ntpdate_flags (time server address) .
4512a357efaSDevin Teske.Pp
4522a357efaSDevin Teske.Nm
4532a357efaSDevin Teskeusbd_flags-"default"
4542a357efaSDevin Teske.Dl returns $usbd_flags or "default" if unset or NULL .
4552a357efaSDevin Teske.Pp
4562a357efaSDevin Teske.Nm
4572a357efaSDevin Teskecloned_interfaces+"alternate"
4582a357efaSDevin Teske.Dl returns "alternate" if $cloned_interfaces is set .
4592a357efaSDevin Teske.Sh SEE ALSO
460872d9e39SNiclas Zeising.Xr jls 1 ,
461872d9e39SNiclas Zeising.Xr rc.conf 5 ,
4624fb1de43SDevin Teske.Xr rc.subr 8 ,
4632a357efaSDevin Teske.Xr jail 8 ,
4642a357efaSDevin Teske.Xr jexec 8 ,
4652a357efaSDevin Teske.Xr rc 8 ,
4662a357efaSDevin Teske.Xr sysctl 8
4672a357efaSDevin Teske.Sh HISTORY
4682a357efaSDevin TeskeA
4692a357efaSDevin Teske.Nm
4702a357efaSDevin Teskeutility first appeared in
471385f5635SDevin Teske.Fx 9.2 .
4722a357efaSDevin Teske.Sh AUTHORS
47301c2b8acSBaptiste Daroussin.An Devin Teske Aq Mt dteske@FreeBSD.org
4742a357efaSDevin Teske.Sh THANKS TO
4752a357efaSDevin TeskeBrandon Gooch, Garrett Cooper, Julian Elischer, Pawel Jakub Dawidek,
476e6c03065SDevin TeskeCyrille Lefevre, Ross West, Stefan Esser, Marco Steinbach, Jilles Tjoelker,
477e6c03065SDevin TeskeAllan Jude, and Lars Engels for suggestions, help, and testing.
478