Difference between revisions of "Sysrc"

From GhostBSD Wiki
Jump to: navigation, search
(Usage)
 
(One intermediate revision by the same user not shown)
Line 9: Line 9:
 
You can edit '''[[Rc.conf]]''' directly with a editor or with the command <code>sysrc</code> on the CLI. With <code>sysrc</code> you can alter '''[[Rc.conf]]''' safely.
 
You can edit '''[[Rc.conf]]''' directly with a editor or with the command <code>sysrc</code> on the CLI. With <code>sysrc</code> you can alter '''[[Rc.conf]]''' safely.
  
With the <code>sysrc -a</code> you get information about all non-default settings in '''/etc/[[Rc.conf|rc.conf]]'''.
+
 
  
 
==Options==
 
==Options==
Line 28: Line 28:
 
|<nowiki>-D</nowiki>||Show default value(s) only (this is the same as setting RC_CONFS  to NULL or passing `-f' with a NULL file-argument).
 
|<nowiki>-D</nowiki>||Show default value(s) only (this is the same as setting RC_CONFS  to NULL or passing `-f' with a NULL file-argument).
 
|-
 
|-
|<nowiki>-e</nowiki>||Print query results as sh(1) compatible syntax (for example, `var=value').  Ignored if either `-n' or `-F' is specified.
+
|<nowiki>-e</nowiki>||Print query results as [https://www.freebsd.org/cgi/man.cgi?query=sh&sektion=1&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports sh(1)] compatible syntax (for example, `var=value').  Ignored if either `-n' or `-F' is specified.
 
|-
 
|-
 
|<nowiki>-E</nowiki>||When given `-l' or `-L' to list configuration files, only list those that exist. When changing a setting, prefer to modify existing files.
 
|<nowiki>-E</nowiki>||When given `-l' or `-L' to list configuration files, only list those that exist. When changing a setting, prefer to modify existing files.
Line 42: Line 42:
 
|<nowiki>-i</nowiki>||Ignore unknown variables.
 
|<nowiki>-i</nowiki>||Ignore unknown variables.
 
|-
 
|-
|<nowiki>-j </nowiki>''jail''||The jid or name of the jail to operate within (overrides `-R  dir'; requires jexec(8)).
+
|<nowiki>-j </nowiki>''jail''||The jid or name of the jail to operate within (overrides `-R  dir'; requires [https://www.freebsd.org/cgi/man.cgi?query=jexec&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports jexec(8)]).
 
|-
 
|-
 
|<nowiki>-l</nowiki>||List configuration files used at startup on stdout and exit.
 
|<nowiki>-l</nowiki>||List configuration files used at startup on stdout and exit.
Line 64: Line 64:
 
|<nowiki>-x</nowiki>||Remove variable(s) from specified file(s).
 
|<nowiki>-x</nowiki>||Remove variable(s) from specified file(s).
 
|}
 
|}
 
  
 
==Example==
 
==Example==
 +
 +
With the <code>sysrc -a</code> you get information about all non-default settings in '''/etc/[[Rc.conf|rc.conf]]'''.
 +
 
$ sysrc -a<br/>
 
$ sysrc -a<br/>
 
autofs_enable: YES<br/>
 
autofs_enable: YES<br/>

Latest revision as of 15:11, 5 April 2020

Welcome to Icon Disti GhostBSD.png Sysrc.
OpenRC
Scripts
/etc/rc
rc - shell
/etc/rc.devd
The generic hook into OpenRC.
/sbin/rcorder
Ordering rc-scripts
/etc/init.d
Scripts to run OpenRC
/usr/local/etc/init.d
Scripts to run OpenRC
/etc/rc.d
Scripts automatically executed at boot and shutdown
/usr/local/etc/rc.d
Special scripts
Configuration
/etc/devd.conf
Configuration file for devd(8)
/etc/conf.d
Initscript Configuration Files
/etc/rc.conf.d
Smaller configuration files
/etc/defaults/rc.conf
Specifies the default settings for all the available options.
/etc/rc.conf
The global OpenRC configuration file
/etc/rc.conf.ghostbsd
GhostBSD specific configurations
Tools/Helper
/usr/sbin/sysrc
Safely edit system rc files
/bin/rc-status
Shows which services are running
/sbin/rc-update
Add or delete services
/sbin/rc-service
Locate and run an OpenRC service
Back to the Icon Disti GhostBSD.pngSystem

Introduction[edit]

The sysrc utility retrieves rc.conf(5) variables from the collection of system rc files and allows processes with appropriate privilege to change values in a safe and effective manner.

Usage[edit]

You can edit Rc.conf directly with a editor or with the command sysrc on the CLI. With sysrc you can alter Rc.conf safely.


Options[edit]

Option Description
-a Dump a list of all non-default configuration variables.
-A Dump a list of all configuration variables (incl. defaults).
-c Check only. For querying, return success if all requested vari ables are set (even if NULL), otherwise return error status. For assignments, return success if no changes are required, otherwise failure. If verbose (see "-v") prints a message stating whether variables are set and/or changes are required.
-d Print a description of the given variable.
-D Show default value(s) only (this is the same as setting RC_CONFS to NULL or passing `-f' with a NULL file-argument).
-e Print query results as sh(1) compatible syntax (for example, `var=value'). Ignored if either `-n' or `-F' is specified.
-E When given `-l' or `-L' to list configuration files, only list those that exist. When changing a setting, prefer to modify existing files.
-f file Operate on the specified file(s) instead of the files obtained by reading the `rc_conf_files' entry in the RC_DEFAULTS file. This option can be specified multiple times for additional files.
-F Show only the last rc.conf(5) file each directive is in.
-h Print a short usage message to stderr and exit.
--help Print a full usage statement to stderr and exit.
-i Ignore unknown variables.
-j jail The jid or name of the jail to operate within (overrides `-R dir'; requires jexec(8)).
-l List configuration files used at startup on stdout and exit.
-L List all configuration files including rc.conf.d entries on stdout and exit. Can be combined with `-v' or `-e' to show service names. sysrc exits with success if all named services are installed, failure otherwise.
-n Show only variable values, not their names.
-N Show only variable names, not their values.
-q Quiet. Disable verbose and hide certain errors. When combined with `-L' and one or more name arguments, provide only exit status and no output.
-R dir Operate within the root directory `dir' rather than `/'.
-s name If an rc.d script of name exists (in/etc/rc.d or local_startup directories), process its rc.conf.d entries as potential overrides to `rc_conf_files'. See rc.subr(8) for additional information on rc.conf.d. Can be combined with `-l' to list configuration files used by service at startup.
-v Verbose. Print the pathname of the specific rc.conf(5) file where the directive was found.
--version Print version information to stdout and exit.
-x Remove variable(s) from specified file(s).

Example[edit]

With the sysrc -a you get information about all non-default settings in /etc/rc.conf.

$ sysrc -a
autofs_enable: YES
cupsd_enable: YES
devfs_system_ruleset: devfsrules_common
dsbmd_enable: NO
hald_enable: YES
hostname: yourname.ghostbsd-pc.home
ifconfig_em0: DHCP
ifconfig_nfe0: DHCP
keymap: de.kbd
kld_list: linux linux64 cuse
kldload_nvidia: nvidia-modeset nvidia
kldload_vbox: vboxdrv
lpd_enable: NO
ntpd_sync_on_start: YES
root_rw_mount: NO
sendmail_enable: NONE
sendmail_msp_queue_enable: NO
sendmail_outbound_enable: NO
sendmail_submit_enable: NO
vboxguest_enable: YES
vboxnet_enable: YES
vboxservice_enable: YES