sysrc.8 (8f0ea33f2bbf3a6aa80235f0a02fa5f2780c2b17) | sysrc.8 (3a40fd5ebdc925b783fb66c1484b34c58156aae8) |
---|---|
1.\" Copyright (c) 2011-2014 Devin Teske | 1.\" Copyright (c) 2011-2015 Devin Teske |
2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright --- 9 unchanged lines hidden (view full) --- 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $FreeBSD$ 26.\" | 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright --- 9 unchanged lines hidden (view full) --- 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $FreeBSD$ 26.\" |
27.Dd November 4, 2014 | 27.Dd March 4, 2015 |
28.Dt SYSRC 8 29.Os 30.Sh NAME 31.Nm sysrc 32.Nd safely edit system rc files 33.Sh SYNOPSIS 34.Nm 35.Op Fl cdDeFhinNqvx 36.Op Fl f Ar file 37.Op Fl j Ar jail | Fl R Ar dir | 28.Dt SYSRC 8 29.Os 30.Sh NAME 31.Nm sysrc 32.Nd safely edit system rc files 33.Sh SYNOPSIS 34.Nm 35.Op Fl cdDeFhinNqvx 36.Op Fl f Ar file 37.Op Fl j Ar jail | Fl R Ar dir |
38.Ar name Ns Op Ns Oo + Oc Ns = Ns Ar value | 38.Ar name Ns Op Ns Oo +|- Oc Ns = Ns Ar value |
39.Ar ... 40.Nm 41.Op Fl cdDeFhinNqvx 42.Op Fl f Ar file 43.Op Fl j Ar jail | Fl R Ar dir 44.Fl a | A 45.Sh DESCRIPTION 46The --- 84 unchanged lines hidden (view full) --- 131This utility has a similar syntax to 132.Xr sysctl 8 . 133It shares the `-e' and `-n' options 134.Pq detailed above 135and also has the same 136.Ql name[=value] 137syntax for making queries/assignments. 138In addition | 39.Ar ... 40.Nm 41.Op Fl cdDeFhinNqvx 42.Op Fl f Ar file 43.Op Fl j Ar jail | Fl R Ar dir 44.Fl a | A 45.Sh DESCRIPTION 46The --- 84 unchanged lines hidden (view full) --- 131This utility has a similar syntax to 132.Xr sysctl 8 . 133It shares the `-e' and `-n' options 134.Pq detailed above 135and also has the same 136.Ql name[=value] 137syntax for making queries/assignments. 138In addition |
139.Pq unlike Xr sysctl 8 , | 139.Pq but unlike Xr sysctl 8 , |
140.Ql name+=value | 140.Ql name+=value |
141is supported for appending values. | 141is supported for adding items to values 142.Pq see APPENDING VALUES 143and 144.Ql name-=value 145is supported for removing items from values 146.Pq see SUBTRACTING VALUES . |
142.Pp 143However, while 144.Xr sysctl 8 145serves to query/modify MIBs in the entrant kernel, 146.Nm 147instead works on values in the system 148.Xr rc.conf 5 149configuration files. --- 32 unchanged lines hidden (view full) --- 182.Nm 183will replace only the last-occurrence in the last-file found to contain the 184variable. 185This gets the value to take effect next boot without heavily 186modifying these integral files (yet taking care not to allow the file to 187grow unwieldy should 188.Nm 189be called repeatedly). | 147.Pp 148However, while 149.Xr sysctl 8 150serves to query/modify MIBs in the entrant kernel, 151.Nm 152instead works on values in the system 153.Xr rc.conf 5 154configuration files. --- 32 unchanged lines hidden (view full) --- 187.Nm 188will replace only the last-occurrence in the last-file found to contain the 189variable. 190This gets the value to take effect next boot without heavily 191modifying these integral files (yet taking care not to allow the file to 192grow unwieldy should 193.Nm 194be called repeatedly). |
195.Sh APPENDING VALUES 196When using the 197.Ql key+=value 198syntax to add items to existing values, 199the first character of the value is taken as the delimiter separating items 200.Pq usually Qo \ Qc or Qo , Qc . 201For example, in the following statement: 202.Bl -tag -width indent+ 203.It \ 204.Nm 205cloned_interfaces+=" gif0" 206.El 207.Pp 208the first character is a space, informing 209.Nm 210that existing values are to be considered separated by whitespace. 211If 212.Ql gif0 213is not found in the existing value for 214.Va cloned_interfaces , 215it is added 216.Pq with delimiter only if existing value is non-NULL . 217.Pp 218For convenience, if the first character is alpha-numeric 219.Pq letters A-Z, a-z, or numbers 0-9 , 220.Nm 221uses the default setting of whitespace as separator. 222For example, the above and below statements are equivalent since 223.Dq gif0 224starts with an alpha-numeric character 225.Pq the letter Li g : 226.Pp 227.Bl -tag -width indent+ 228.It \ 229.Nm 230cloned_interfaces+=gif0 231.El 232.Pp 233Take the following sequence for example: 234.Bl -tag -width indent+ 235.It \ 236.Nm 237cloned_interfaces= # start with NULL 238.It \ 239.Nm 240cloned_interfaces+=gif0 241.Dl # NULL -> `gif0' Pq NB: no preceding delimiter 242.It \ 243.Nm 244cloned_interfaces+=gif0 # no change 245.It \ 246.Nm 247cloned_interfaces+="tun0 gif0" 248.Dl # `gif0' -> `gif0 tun0' Pq NB: no duplication 249.El 250.Pp 251.Nm 252prevents the same value from being added if already there. 253.Sh SUBTRACTING VALUES 254When using the 255.Ql key-=value 256syntax to remove items from existing values, 257the first character of the value is taken as the delimiter separating items 258.Pq usually Qo \ Qc or Qo , Qc . 259For example, in the following statement: 260.Pp 261.Dl Nm cloned_interfaces-=" gif0" 262.Pp 263the first character is a space, informing 264.Nm 265that existing values are to be considered separated by whitespace. 266If 267.Ql gif0 268is found in the existing value for 269.Va cloned_interfaces , 270it is removed 271.Pq extra delimiters removed . 272.Pp 273For convenience, if the first character is alpha-numeric 274.Pq letters A-Z, a-z, or numbers 0-9 , 275.Nm 276uses the default setting of whitespace as separator. 277For example, the above and below statements are equivalent since 278.Dq gif0 279starts with an alpha-numeric character 280.Pq the letter Li g : 281.Pp 282.Bl -tag -width indent+ 283.It \ 284.Nm 285cloned_interfaces-=gif0 286.El 287.Pp 288Take the following sequence for example: 289.Bl -tag -width indent+ 290.It \ 291.Nm 292foo="bar baz" # start 293.It \ 294.Nm 295foo-=bar # `bar baz' -> `baz' 296.It \ 297.Nm 298foo-=baz # `baz' -> NULL 299.El 300.Pp 301.Nm 302removes all occurrences of all items provided 303and collapses extra delimiters between items. |
|
190.Sh ENVIRONMENT 191The following environment variables are referenced by 192.Nm : 193.Bl -tag -width ".Ev RC_DEFAULTS" 194.It Ev RC_CONFS 195Override default 196.Ql rc_conf_files 197.Pq even if set to NULL . --- 47 unchanged lines hidden (view full) --- 245.Pp 246.Nm 247-f /etc/crontab MAILTO 248.Dl returns the value of the MAILTO setting Pq if configured . 249.Pp 250Appending to existing values: 251.Pp 252.Nm | 304.Sh ENVIRONMENT 305The following environment variables are referenced by 306.Nm : 307.Bl -tag -width ".Ev RC_DEFAULTS" 308.It Ev RC_CONFS 309Override default 310.Ql rc_conf_files 311.Pq even if set to NULL . --- 47 unchanged lines hidden (view full) --- 359.Pp 360.Nm 361-f /etc/crontab MAILTO 362.Dl returns the value of the MAILTO setting Pq if configured . 363.Pp 364Appending to existing values: 365.Pp 366.Nm |
253\&cloned_interfaces+=" gif0" 254.Dl appends Qo \ gif0 Qc to $cloned_interfaces . | 367\&cloned_interfaces+=gif0 368.Dl appends Qo gif0 Qc to $cloned_interfaces Pq see APPENDING VALUES . |
255.Pp | 369.Pp |
370.Nm 371\&cloned_interfaces-=gif0 372.Dl removes Qo gif0 Qc from $cloned_interfaces Pq see SUBTRACTING VALUES . 373.Pp |
|
256In addition to the above syntax, 257.Nm 258also supports inline 259.Xr sh 1 260PARAMETER expansion for changing the way values are reported, shown below: 261.Pp 262.Nm 263\&'hostname%%.*' --- 56 unchanged lines hidden --- | 374In addition to the above syntax, 375.Nm 376also supports inline 377.Xr sh 1 378PARAMETER expansion for changing the way values are reported, shown below: 379.Pp 380.Nm 381\&'hostname%%.*' --- 56 unchanged lines hidden --- |