xref: /freebsd/usr.sbin/sysrc/sysrc.8 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1613d7da7SDevin 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.\"
25*1a0bd266SJose Luis Duran.Dd April 3, 2022
262a357efaSDevin Teske.Dt SYSRC 8
272a357efaSDevin Teske.Os
282a357efaSDevin Teske.Sh NAME
292a357efaSDevin Teske.Nm sysrc
302a357efaSDevin Teske.Nd safely edit system rc files
312a357efaSDevin Teske.Sh SYNOPSIS
322a357efaSDevin Teske.Nm
334fb1de43SDevin Teske.Op Fl cdDeEFhinNqvx
344fb1de43SDevin Teske.Op Fl s Ar name
352a357efaSDevin Teske.Op Fl f Ar file
362a357efaSDevin Teske.Op Fl j Ar jail | Fl R Ar dir
373a40fd5eSDevin Teske.Ar name Ns Op Ns Oo +|- Oc Ns = Ns Ar value
382a357efaSDevin Teske.Ar ...
392a357efaSDevin Teske.Nm
404fb1de43SDevin Teske.Op Fl cdDeEFhinNqvx
414fb1de43SDevin Teske.Op Fl s Ar name
422a357efaSDevin Teske.Op Fl f Ar file
432a357efaSDevin Teske.Op Fl j Ar jail | Fl R Ar dir
442a357efaSDevin Teske.Fl a | A
454fb1de43SDevin Teske.Nm
464fb1de43SDevin Teske.Op Fl E
474fb1de43SDevin Teske.Op Fl s Ar name
484fb1de43SDevin Teske.Op Fl f Ar file
494fb1de43SDevin Teske.Fl l
504fb1de43SDevin Teske.Nm
514fb1de43SDevin Teske.Op Fl eEqv
524fb1de43SDevin Teske.Fl L
534fb1de43SDevin Teske.Op Ar name ...
542a357efaSDevin Teske.Sh DESCRIPTION
552a357efaSDevin TeskeThe
562a357efaSDevin Teske.Nm
572a357efaSDevin Teskeutility retrieves
582a357efaSDevin Teske.Xr rc.conf 5
592a357efaSDevin Teskevariables from the collection of system rc files and allows processes with
602a357efaSDevin Teskeappropriate privilege to change values in a safe and effective manner.
612a357efaSDevin Teske.Pp
622a357efaSDevin TeskeThe following options are available:
632a357efaSDevin Teske.Bl -tag -width indent+
642a357efaSDevin Teske.It Fl a
652a357efaSDevin TeskeDump a list of all non-default configuration variables.
662a357efaSDevin Teske.It Fl A
672a357efaSDevin TeskeDump a list of all configuration variables
682a357efaSDevin Teske.Pq incl. defaults .
694cc57221SDevin Teske.It Fl c
70e6c03065SDevin TeskeCheck only.
71e6c03065SDevin TeskeFor querying, return success if all requested variables are set
72e6c03065SDevin Teske.Pq even if NULL ,
73e6c03065SDevin Teskeotherwise return error status.
74e6c03065SDevin TeskeFor assignments, return success if no changes are required, otherwise failure.
754cc57221SDevin TeskeIf verbose
764cc57221SDevin Teske.Pq see Dq Fl v
77e6c03065SDevin Teskeprints a message stating whether variables are set and/or changes are required.
782a357efaSDevin Teske.It Fl d
792a357efaSDevin TeskePrint a description of the given variable.
802a357efaSDevin Teske.It Fl D
812a357efaSDevin TeskeShow default value(s) only (this is the same as setting RC_CONFS to NULL or
822a357efaSDevin Teskepassing `-f' with a NULL file-argument).
832a357efaSDevin Teske.It Fl e
842a357efaSDevin TeskePrint query results as
85379cb6baSDevin Teske.Xr sh 1
86379cb6baSDevin Teskecompatible syntax
87379cb6baSDevin Teske.Pq for example, Ql var=value .
88379cb6baSDevin TeskeIgnored if either
89379cb6baSDevin Teske.Ql Fl n
90379cb6baSDevin Teskeor
91379cb6baSDevin Teske.Ql Fl F
922a357efaSDevin Teskeis specified.
934fb1de43SDevin Teske.It Fl E
944fb1de43SDevin TeskeWhen given
954fb1de43SDevin Teske.Sq Fl l
964fb1de43SDevin Teskeor
974fb1de43SDevin Teske.Sq Fl L
984fb1de43SDevin Tesketo list configuration files, only list those that exist.
994fb1de43SDevin TeskeWhen changing a setting, prefer to modify existing files.
1002a357efaSDevin Teske.It Fl f Ar file
1012a357efaSDevin TeskeOperate on the specified file(s) instead of the files obtained by reading the
1022a357efaSDevin Teske.Sq rc_conf_files
1032a357efaSDevin Teskeentry in the
1042a357efaSDevin Teske.Ev RC_DEFAULTS
1052a357efaSDevin Teskefile.
1062a357efaSDevin TeskeThis option can be specified multiple times for additional files.
1072a357efaSDevin Teske.It Fl F
1082a357efaSDevin TeskeShow only the last
1092a357efaSDevin Teske.Xr rc.conf 5
1102a357efaSDevin Teskefile each directive is in.
1112a357efaSDevin Teske.It Fl h
1122a357efaSDevin TeskePrint a short usage message to stderr and exit.
1132a357efaSDevin Teske.It Fl -help
1142a357efaSDevin TeskePrint a full usage statement to stderr and exit.
1152a357efaSDevin Teske.It Fl i
1162a357efaSDevin TeskeIgnore unknown variables.
1172a357efaSDevin Teske.It Fl j Ar jail
1182a357efaSDevin TeskeThe
1192a357efaSDevin Teske.Ar jid
1202a357efaSDevin Teskeor name of the
1212a357efaSDevin Teske.Ar jail
1222a357efaSDevin Tesketo operate within
1232a357efaSDevin Teske.Pq overrides So Fl R Ar dir Sc ; requires Xr jexec 8 .
1244fb1de43SDevin Teske.It Fl l
1254fb1de43SDevin TeskeList configuration files used at startup on stdout and exit.
1264fb1de43SDevin Teske.It Fl L
1274fb1de43SDevin TeskeList all configuration files including rc.conf.d entries on stdout and exit.
1284fb1de43SDevin TeskeCan be combined with
1294fb1de43SDevin Teske.Sq Fl v
1304fb1de43SDevin Teskeor
1314fb1de43SDevin Teske.Sq Fl e
1324fb1de43SDevin Tesketo show service names.
1334fb1de43SDevin Teske.Nm
1344fb1de43SDevin Teskeexits with success if all named services are installed, failure otherwise.
1352a357efaSDevin Teske.It Fl n
1362a357efaSDevin TeskeShow only variable values, not their names.
1372a357efaSDevin Teske.It Fl N
1382a357efaSDevin TeskeShow only variable names, not their values.
1392a357efaSDevin Teske.It Fl q
1403dacd67eSJoel DahlQuiet.
141e6c03065SDevin TeskeDisable verbose and hide certain errors.
1424fb1de43SDevin TeskeWhen combined with
1434fb1de43SDevin Teske.Sq Fl L
1444fb1de43SDevin Teskeand one or more
1454f2f8d7dSMateusz Piotrowski.Ar name
1464fb1de43SDevin Teskearguments, provide only exit status and no output.
1472a357efaSDevin Teske.It Fl R Ar dir
1482a357efaSDevin TeskeOperate within the root directory
149e6c03065SDevin Teske.Sq Ar dir
1502a357efaSDevin Teskerather than
151e6c03065SDevin Teske.Sq / .
1524fb1de43SDevin Teske.It Fl s Ar name
1534fb1de43SDevin TeskeIf an
1544fb1de43SDevin Teske.Li rc.d
1554fb1de43SDevin Teskescript of
1564fb1de43SDevin Teske.Ar name
1574fb1de43SDevin Teskeexists
1584fb1de43SDevin Teske.Po
1594fb1de43SDevin Teskein
1604fb1de43SDevin Teske.Dq /etc/rc.d
1614fb1de43SDevin Teskeor
1624fb1de43SDevin Teske.Li local_startup
1634fb1de43SDevin Teskedirectories
1644fb1de43SDevin Teske.Pc ,
1654fb1de43SDevin Teskeprocess its
1664fb1de43SDevin Teske.Dq rc.conf.d
1674fb1de43SDevin Teskeentries as potential overrides to
1684fb1de43SDevin Teske.Sq rc_conf_files .
1694fb1de43SDevin TeskeSee
1704fb1de43SDevin Teske.Xr rc.subr 8
1714fb1de43SDevin Teskefor additional information on
1724fb1de43SDevin Teske.Dq rc.conf.d .
1734fb1de43SDevin TeskeCan be combined with
1744fb1de43SDevin Teske.Sq Fl l
1754fb1de43SDevin Tesketo list configuration files used by service at startup.
1762a357efaSDevin Teske.It Fl v
1773dacd67eSJoel DahlVerbose.
1783dacd67eSJoel DahlPrint the pathname of the specific
1792a357efaSDevin Teske.Xr rc.conf 5
1802a357efaSDevin Teskefile where the directive was found.
1813e74984cSDevin Teske.It Fl -version
1823e74984cSDevin TeskePrint version information to stdout and exit.
1832a357efaSDevin Teske.It Fl x
1842a357efaSDevin TeskeRemove variable(s) from specified file(s).
1852a357efaSDevin Teske.El
1862a357efaSDevin Teske.Pp
187e6c03065SDevin TeskeThis utility has a similar syntax to
1882a357efaSDevin Teske.Xr sysctl 8 .
1892a357efaSDevin TeskeIt shares the `-e' and `-n' options
1902a357efaSDevin Teske.Pq detailed above
1912a357efaSDevin Teskeand also has the same
1922a357efaSDevin Teske.Ql name[=value]
193e6c03065SDevin Teskesyntax for making queries/assignments.
194a7bdf21cSDevin TeskeIn addition
1953a40fd5eSDevin Teske.Pq but unlike Xr sysctl 8 ,
196a7bdf21cSDevin Teske.Ql name+=value
1973a40fd5eSDevin Teskeis supported for adding items to values
1983a40fd5eSDevin Teske.Pq see APPENDING VALUES
1993a40fd5eSDevin Teskeand
2003a40fd5eSDevin Teske.Ql name-=value
2013a40fd5eSDevin Teskeis supported for removing items from values
2023a40fd5eSDevin Teske.Pq see SUBTRACTING VALUES .
2032a357efaSDevin Teske.Pp
2042a357efaSDevin TeskeHowever, while
2052a357efaSDevin Teske.Xr sysctl 8
2062a357efaSDevin Teskeserves to query/modify MIBs in the entrant kernel,
207be15d0e4SJoel Dahl.Nm
2082a357efaSDevin Teskeinstead works on values in the system
2092a357efaSDevin Teske.Xr rc.conf 5
2102a357efaSDevin Teskeconfiguration files.
2112a357efaSDevin Teske.Pp
2122a357efaSDevin TeskeThe list of system configuration files is configured in the file
2132a357efaSDevin Teske.Ql /etc/defaults/rc.conf
2142a357efaSDevin Teskewithin the variable
2152a357efaSDevin Teske.Ql rc_conf_files ,
2163dacd67eSJoel Dahlwhich by-default contains a space-separated list of pathnames.
2174f2f8d7dSMateusz PiotrowskiOn all
2184f2f8d7dSMateusz Piotrowski.Fx
2193dacd67eSJoel Dahlsystems, this defaults to the value "/etc/rc.conf /etc/rc.conf.local".
2203dacd67eSJoel DahlEach
2213dacd67eSJoel Dahlpathname is sourced in-order upon startup.
2223dacd67eSJoel DahlIt is in the same fashion that
2232a357efaSDevin Teske.Nm
2242a357efaSDevin Teskesources the configuration files before returning the value of the given
2252a357efaSDevin Teskevariable.
2262a357efaSDevin Teske.Pp
2272a357efaSDevin TeskeWhen supplied a variable name,
2282a357efaSDevin Teske.Nm
2293dacd67eSJoel Dahlwill return the value of the variable.
2303dacd67eSJoel DahlIf the variable does not appear in any
2312a357efaSDevin Teskeof the configured
2322a357efaSDevin Teske.Ql rc_conf_files ,
2332a357efaSDevin Teskean error is printed and error status is returned.
2342a357efaSDevin Teske.Pp
2352a357efaSDevin TeskeWhen changing values of a given variable, it does not matter if the variable
2362a357efaSDevin Teskeappears in any of the
2372a357efaSDevin Teske.Ql rc_conf_files
2383dacd67eSJoel Dahlor not.
2393dacd67eSJoel DahlIf the variable does not appear in any of the files, it is appended to
2402a357efaSDevin Teskethe end of the first pathname in the
2412a357efaSDevin Teske.Ql rc_conf_files
2423dacd67eSJoel Dahlvariable.
2433dacd67eSJoel DahlOtherwise,
2442a357efaSDevin Teske.Nm
2452a357efaSDevin Teskewill replace only the last-occurrence in the last-file found to contain the
2463dacd67eSJoel Dahlvariable.
2473dacd67eSJoel DahlThis gets the value to take effect next boot without heavily
2482a357efaSDevin Teskemodifying these integral files (yet taking care not to allow the file to
2492a357efaSDevin Teskegrow unwieldy should
2502a357efaSDevin Teske.Nm
2512a357efaSDevin Teskebe called repeatedly).
2523a40fd5eSDevin Teske.Sh APPENDING VALUES
2533a40fd5eSDevin TeskeWhen using the
2543a40fd5eSDevin Teske.Ql key+=value
2553a40fd5eSDevin Teskesyntax to add items to existing values,
2563a40fd5eSDevin Teskethe first character of the value is taken as the delimiter separating items
25797ee0399SDevin Teske.Pq usually Qo " " Qc or Qo , Qc .
2583a40fd5eSDevin TeskeFor example, in the following statement:
2598fdb5185SDevin Teske.Bl -item -offset indent
2608fdb5185SDevin Teske.It
2613a40fd5eSDevin Teske.Nm
2623a40fd5eSDevin Teskecloned_interfaces+=" gif0"
2633a40fd5eSDevin Teske.El
2643a40fd5eSDevin Teske.Pp
2653a40fd5eSDevin Teskethe first character is a space, informing
2663a40fd5eSDevin Teske.Nm
2673a40fd5eSDevin Teskethat existing values are to be considered separated by whitespace.
2683a40fd5eSDevin TeskeIf
2693a40fd5eSDevin Teske.Ql gif0
2703a40fd5eSDevin Teskeis not found in the existing value for
2713a40fd5eSDevin Teske.Va cloned_interfaces ,
2723a40fd5eSDevin Teskeit is added
2733a40fd5eSDevin Teske.Pq with delimiter only if existing value is non-NULL .
2743a40fd5eSDevin Teske.Pp
2753a40fd5eSDevin TeskeFor convenience, if the first character is alpha-numeric
2763a40fd5eSDevin Teske.Pq letters A-Z, a-z, or numbers 0-9 ,
2776350eae8SDevin Teskedot
2784f2f8d7dSMateusz Piotrowski.Pq Li \&. ,
2796350eae8SDevin Teskeor slash
2806350eae8SDevin Teske.Pq Li / ,
2813a40fd5eSDevin Teske.Nm
2823a40fd5eSDevin Teskeuses the default setting of whitespace as separator.
2833a40fd5eSDevin TeskeFor example, the above and below statements are equivalent since
2843a40fd5eSDevin Teske.Dq gif0
2853a40fd5eSDevin Teskestarts with an alpha-numeric character
2863a40fd5eSDevin Teske.Pq the letter Li g :
2878fdb5185SDevin Teske.Bl -item -offset indent
2888fdb5185SDevin Teske.It
2893a40fd5eSDevin Teske.Nm
2903a40fd5eSDevin Teskecloned_interfaces+=gif0
2913a40fd5eSDevin Teske.El
2923a40fd5eSDevin Teske.Pp
2933a40fd5eSDevin TeskeTake the following sequence for example:
2948fdb5185SDevin Teske.Bl -item -offset indent
2958fdb5185SDevin Teske.It
2963a40fd5eSDevin Teske.Nm
2973a40fd5eSDevin Teskecloned_interfaces= # start with NULL
2988fdb5185SDevin Teske.It
2993a40fd5eSDevin Teske.Nm
3003a40fd5eSDevin Teskecloned_interfaces+=gif0
3013a40fd5eSDevin Teske.Dl # NULL -> `gif0' Pq NB: no preceding delimiter
3028fdb5185SDevin Teske.It
3033a40fd5eSDevin Teske.Nm
3043a40fd5eSDevin Teskecloned_interfaces+=gif0 # no change
3058fdb5185SDevin Teske.It
3063a40fd5eSDevin Teske.Nm
3073a40fd5eSDevin Teskecloned_interfaces+="tun0 gif0"
3083a40fd5eSDevin Teske.Dl # `gif0' -> `gif0 tun0' Pq NB: no duplication
3093a40fd5eSDevin Teske.El
3103a40fd5eSDevin Teske.Pp
3113a40fd5eSDevin Teske.Nm
3123a40fd5eSDevin Teskeprevents the same value from being added if already there.
3133a40fd5eSDevin Teske.Sh SUBTRACTING VALUES
3143a40fd5eSDevin TeskeWhen using the
3153a40fd5eSDevin Teske.Ql key-=value
3163a40fd5eSDevin Teskesyntax to remove items from existing values,
3173a40fd5eSDevin Teskethe first character of the value is taken as the delimiter separating items
31897ee0399SDevin Teske.Pq usually Qo " " Qc or Qo , Qc .
3193a40fd5eSDevin TeskeFor example, in the following statement:
3203a40fd5eSDevin Teske.Pp
3213a40fd5eSDevin Teske.Dl Nm cloned_interfaces-=" gif0"
3223a40fd5eSDevin Teske.Pp
3233a40fd5eSDevin Teskethe first character is a space, informing
3243a40fd5eSDevin Teske.Nm
3253a40fd5eSDevin Teskethat existing values are to be considered separated by whitespace.
3263a40fd5eSDevin TeskeIf
3273a40fd5eSDevin Teske.Ql gif0
3283a40fd5eSDevin Teskeis found in the existing value for
3293a40fd5eSDevin Teske.Va cloned_interfaces ,
3303a40fd5eSDevin Teskeit is removed
3313a40fd5eSDevin Teske.Pq extra delimiters removed .
3323a40fd5eSDevin Teske.Pp
3333a40fd5eSDevin TeskeFor convenience, if the first character is alpha-numeric
3343a40fd5eSDevin Teske.Pq letters A-Z, a-z, or numbers 0-9 ,
3356350eae8SDevin Teskedot
3364f2f8d7dSMateusz Piotrowski.Pq Li \&. ,
3376350eae8SDevin Teskeor slash
3386350eae8SDevin Teske.Pq Li / ,
3393a40fd5eSDevin Teske.Nm
3403a40fd5eSDevin Teskeuses the default setting of whitespace as separator.
3413a40fd5eSDevin TeskeFor example, the above and below statements are equivalent since
3423a40fd5eSDevin Teske.Dq gif0
3433a40fd5eSDevin Teskestarts with an alpha-numeric character
3443a40fd5eSDevin Teske.Pq the letter Li g :
3458fdb5185SDevin Teske.Bl -item -offset indent
3468fdb5185SDevin Teske.It
3473a40fd5eSDevin Teske.Nm
3483a40fd5eSDevin Teskecloned_interfaces-=gif0
3493a40fd5eSDevin Teske.El
3503a40fd5eSDevin Teske.Pp
3513a40fd5eSDevin TeskeTake the following sequence for example:
3528fdb5185SDevin Teske.Bl -item -offset indent
3538fdb5185SDevin Teske.It
3543a40fd5eSDevin Teske.Nm
3553a40fd5eSDevin Teskefoo="bar baz" # start
3568fdb5185SDevin Teske.It
3573a40fd5eSDevin Teske.Nm
3583a40fd5eSDevin Teskefoo-=bar # `bar baz' -> `baz'
3598fdb5185SDevin Teske.It
3603a40fd5eSDevin Teske.Nm
3613a40fd5eSDevin Teskefoo-=baz # `baz' -> NULL
3623a40fd5eSDevin Teske.El
3633a40fd5eSDevin Teske.Pp
3643a40fd5eSDevin Teske.Nm
3653a40fd5eSDevin Teskeremoves all occurrences of all items provided
3663a40fd5eSDevin Teskeand collapses extra delimiters between items.
3672a357efaSDevin Teske.Sh ENVIRONMENT
3682a357efaSDevin TeskeThe following environment variables are referenced by
3692a357efaSDevin Teske.Nm :
370bc3ccb90SDevin Teske.Bl -tag -width ".Ev RC_DEFAULTS"
3712a357efaSDevin Teske.It Ev RC_CONFS
3722a357efaSDevin TeskeOverride default
3732a357efaSDevin Teske.Ql rc_conf_files
3742a357efaSDevin Teske.Pq even if set to NULL .
3752a357efaSDevin Teske.It Ev RC_DEFAULTS
3762a357efaSDevin TeskeLocation of
3772a357efaSDevin Teske.Ql /etc/defaults/rc.conf
3782a357efaSDevin Teskefile.
3792a357efaSDevin Teske.El
3802a357efaSDevin Teske.Sh DEPENDENCIES
3812a357efaSDevin TeskeThe following standard commands are required by
3822a357efaSDevin Teske.Nm :
3832a357efaSDevin Teske.Pp
3842a357efaSDevin Teske.Xr awk 1 ,
3852a357efaSDevin Teske.Xr cat 1 ,
3862a357efaSDevin Teske.Xr chmod 1 ,
3872a357efaSDevin Teske.Xr env 1 ,
3882a357efaSDevin Teske.Xr grep 1 ,
3892a357efaSDevin Teske.Xr mktemp 1 ,
3902a357efaSDevin Teske.Xr mv 1 ,
3912a357efaSDevin Teske.Xr rm 1 ,
3922a357efaSDevin Teske.Xr sh 1 ,
3932a357efaSDevin Teske.Xr stat 1 ,
394872d9e39SNiclas Zeising.Xr tail 1 ,
3958f6e6509SEdward Tomasz Napierala.Xr chown 8 ,
396*1a0bd266SJose Luis Duran.Xr chroot 8 ,
3978f6e6509SEdward Tomasz Napierala.Xr jls 8 ,
398872d9e39SNiclas Zeisingand
399872d9e39SNiclas Zeising.Xr jexec 8 .
4002a357efaSDevin Teske.Sh FILES
4012a357efaSDevin Teske.Bl -tag -width ".Pa /etc/defaults/rc.conf" -compact
4022a357efaSDevin Teske.It Pa /etc/defaults/rc.conf
4032a357efaSDevin Teske.It Pa /etc/rc.conf
4042a357efaSDevin Teske.It Pa /etc/rc.conf.local
4054fb1de43SDevin Teske.It Pa /etc/rc.conf.d/name
4064fb1de43SDevin Teske.It Pa /etc/rc.conf.d/name/*
4074fb1de43SDevin Teske.It Pa /usr/local/etc/rc.conf.d/name
4084fb1de43SDevin Teske.It Pa /usr/local/etc/rc.conf.d/name/*
4092a357efaSDevin Teske.El
4102a357efaSDevin Teske.Sh EXAMPLES
4112a357efaSDevin TeskeBelow are some simple examples of how
4122a357efaSDevin Teske.Nm
4132a357efaSDevin Teskecan be used to query certain values from the
4142a357efaSDevin Teske.Xr rc.conf 5
4152a357efaSDevin Teskecollection of system configuration files:
4162a357efaSDevin Teske.Pp
4172a357efaSDevin Teske.Nm
4182a357efaSDevin Teskesshd_enable
4192a357efaSDevin Teske.Dl returns the value of $sshd_enable, usually YES or NO .
4202a357efaSDevin Teske.Pp
4212a357efaSDevin Teske.Nm
4222a357efaSDevin Teskedefaultrouter
4232a357efaSDevin Teske.Dl returns IP address of default router Pq if configured .
4242a357efaSDevin Teske.Pp
4252a357efaSDevin TeskeWorking on other files, such as
4262a357efaSDevin Teske.Xr crontab 5 :
4272a357efaSDevin Teske.Pp
4282a357efaSDevin Teske.Nm
4292a357efaSDevin Teske-f /etc/crontab MAILTO
4302a357efaSDevin Teske.Dl returns the value of the MAILTO setting Pq if configured .
4312a357efaSDevin Teske.Pp
432e8f6aafbSDevin TeskeAppending to existing values:
433e8f6aafbSDevin Teske.Pp
434e8f6aafbSDevin Teske.Nm
4353a40fd5eSDevin Teske\&cloned_interfaces+=gif0
4363a40fd5eSDevin Teske.Dl appends Qo gif0 Qc to $cloned_interfaces Pq see APPENDING VALUES .
4373a40fd5eSDevin Teske.Pp
4383a40fd5eSDevin Teske.Nm
4393a40fd5eSDevin Teske\&cloned_interfaces-=gif0
4403a40fd5eSDevin Teske.Dl removes Qo gif0 Qc from $cloned_interfaces Pq see SUBTRACTING VALUES .
441e8f6aafbSDevin Teske.Pp
4422a357efaSDevin TeskeIn addition to the above syntax,
4432a357efaSDevin Teske.Nm
4442a357efaSDevin Teskealso supports inline
4452a357efaSDevin Teske.Xr sh 1
4462a357efaSDevin TeskePARAMETER expansion for changing the way values are reported, shown below:
4472a357efaSDevin Teske.Pp
4482a357efaSDevin Teske.Nm
4492a357efaSDevin Teske\&'hostname%%.*'
4502a357efaSDevin Teske.Dl returns $hostname up to (but not including) first `.' .
4512a357efaSDevin Teske.Pp
4522a357efaSDevin Teske.Nm
4532a357efaSDevin Teske\&'network_interfaces%%[$IFS]*'
4542a357efaSDevin Teske.Dl returns first word of $network_interfaces .
4552a357efaSDevin Teske.Pp
4562a357efaSDevin Teske.Nm
4572a357efaSDevin Teske\&'ntpdate_flags##*[$IFS]'
4582a357efaSDevin Teske.Dl returns last word of $ntpdate_flags (time server address) .
4592a357efaSDevin Teske.Pp
4602a357efaSDevin Teske.Nm
4612a357efaSDevin Teskeusbd_flags-"default"
4622a357efaSDevin Teske.Dl returns $usbd_flags or "default" if unset or NULL .
4632a357efaSDevin Teske.Pp
4642a357efaSDevin Teske.Nm
4652a357efaSDevin Teskecloned_interfaces+"alternate"
4662a357efaSDevin Teske.Dl returns "alternate" if $cloned_interfaces is set .
4672a357efaSDevin Teske.Sh SEE ALSO
468872d9e39SNiclas Zeising.Xr rc.conf 5 ,
4692a357efaSDevin Teske.Xr jail 8 ,
4702a357efaSDevin Teske.Xr jexec 8 ,
4718f6e6509SEdward Tomasz Napierala.Xr jls 8 ,
4722a357efaSDevin Teske.Xr rc 8 ,
4734f2f8d7dSMateusz Piotrowski.Xr rc.subr 8 ,
4742a357efaSDevin Teske.Xr sysctl 8
4752a357efaSDevin Teske.Sh HISTORY
4762a357efaSDevin TeskeA
4772a357efaSDevin Teske.Nm
4782a357efaSDevin Teskeutility first appeared in
479385f5635SDevin Teske.Fx 9.2 .
4802a357efaSDevin Teske.Sh AUTHORS
48101c2b8acSBaptiste Daroussin.An Devin Teske Aq Mt dteske@FreeBSD.org
4822a357efaSDevin Teske.Sh THANKS TO
483da5069e1SEnji CooperBrandon Gooch, Enji Cooper, Julian Elischer, Pawel Jakub Dawidek,
484e6c03065SDevin TeskeCyrille Lefevre, Ross West, Stefan Esser, Marco Steinbach, Jilles Tjoelker,
485e6c03065SDevin TeskeAllan Jude, and Lars Engels for suggestions, help, and testing.
486