Changeset View
Changeset View
Standalone View
Standalone View
libexec/rc/rc.subr
| Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
| ID="/usr/bin/id" | ID="/usr/bin/id" | ||||
| IDCMD="if [ -x $ID ]; then $ID -un; fi" | IDCMD="if [ -x $ID ]; then $ID -un; fi" | ||||
| PS="/bin/ps -ww" | PS="/bin/ps -ww" | ||||
| SERVICE=/usr/sbin/service | SERVICE=/usr/sbin/service | ||||
| JAIL_CMD=/usr/sbin/jail | JAIL_CMD=/usr/sbin/jail | ||||
| _svcj_generic_params="path=/ mount.nodevfs host=inherit" | _svcj_generic_params="path=/ mount.nodevfs host=inherit" | ||||
| JID=0 | JID=0 | ||||
| CPUSET="/bin/cpuset" | CPUSET="/bin/cpuset" | ||||
| SETAUDIT="/usr/sbin/setaudit" | |||||
| # Cache the services that we loaded with load_rc_config. | # Cache the services that we loaded with load_rc_config. | ||||
| _loaded_services="" | _loaded_services="" | ||||
| # rc_service provides the path to the service script that we are executing. | # rc_service provides the path to the service script that we are executing. | ||||
| # This is not being set here in an execution context, necessarily, so it's | # This is not being set here in an execution context, necessarily, so it's | ||||
| # really just a reasonable guess, and it will get overwritten later if | # really just a reasonable guess, and it will get overwritten later if | ||||
| # we are executing from some other means than direct execution by service(8) | # we are executing from some other means than direct execution by service(8) | ||||
| ▲ Show 20 Lines • Show All 862 Lines • ▼ Show 20 Lines | |||||
| # | # | ||||
| # rcvar n This is checked with checkyesno to determine | # rcvar n This is checked with checkyesno to determine | ||||
| # if the action should be run. | # if the action should be run. | ||||
| # | # | ||||
| # ${name}_program n Full path to command. | # ${name}_program n Full path to command. | ||||
| # Meant to be used in /etc/rc.conf to override | # Meant to be used in /etc/rc.conf to override | ||||
| # ${command}. | # ${command}. | ||||
| # | # | ||||
| # ${name}_audit_user n Override the audit user for ${command}, | |||||
0mp: style nit to match other entries in the list
| |||||
| # specified as a user name or UID. | |||||
| # | |||||
| # ${name}_chroot n Directory to chroot to before running ${command} | # ${name}_chroot n Directory to chroot to before running ${command} | ||||
| # Requires /usr to be mounted. | # Requires /usr to be mounted. | ||||
| # | # | ||||
| # ${name}_chdir n Directory to cd to before running ${command} | # ${name}_chdir n Directory to cd to before running ${command} | ||||
| # (if not using ${name}_chroot). | # (if not using ${name}_chroot). | ||||
| # | # | ||||
| # ${name}_cpuset n A list of CPUs to run ${command} on. | # ${name}_cpuset n A list of CPUs to run ${command} on. | ||||
| # Requires /usr to be mounted. | # Requires /usr to be mounted. | ||||
| ▲ Show 20 Lines • Show All 202 Lines • ▼ Show 20 Lines | run_rc_command() | ||||
| *) _cpuset="" ;; | *) _cpuset="" ;; | ||||
| esac | esac | ||||
| _cpusetcmd= | _cpusetcmd= | ||||
| if [ -n "$_cpuset" ]; then | if [ -n "$_cpuset" ]; then | ||||
| _cpusetcmd="$CPUSET -l $_cpuset" | _cpusetcmd="$CPUSET -l $_cpuset" | ||||
| fi | fi | ||||
| eval _audit_user=\$${name}_audit_user | |||||
| if [ -z "$_audit_user" -a -n "$audit_user" ]; then | |||||
| _audit_user=$audit_user | |||||
| fi | |||||
| _setauditcmd= | |||||
| if [ -n "$_audit_user" ]; then | |||||
| _setauditcmd="setaudit -U -a $_audit_user" | |||||
| fi | |||||
| # If a specific jail has a specific svcj request, honor it (YES/NO). | # If a specific jail has a specific svcj request, honor it (YES/NO). | ||||
| # If not (variable empty), evaluate the global svcj catch-all. | # If not (variable empty), evaluate the global svcj catch-all. | ||||
| # A global YES can be overriden by a specific NO, and a global NO is overriden | # A global YES can be overriden by a specific NO, and a global NO is overriden | ||||
| # by a specific YES. | # by a specific YES. | ||||
| eval _svcj=\$${name}_svcj | eval _svcj=\$${name}_svcj | ||||
| if [ -z "$_svcj" ]; then | if [ -z "$_svcj" ]; then | ||||
| _svcj=${svcj_all_enable} | _svcj=${svcj_all_enable} | ||||
| if [ -z "$_svcj" ]; then | if [ -z "$_svcj" ]; then | ||||
| ▲ Show 20 Lines • Show All 348 Lines • ▼ Show 20 Lines | start) | ||||
| # setup the full command to run | # setup the full command to run | ||||
| # | # | ||||
| startmsg "Starting ${name}." | startmsg "Starting ${name}." | ||||
| if [ -n "$_chroot" ]; then | if [ -n "$_chroot" ]; then | ||||
| _cd= | _cd= | ||||
| _doit="\ | _doit="\ | ||||
| ${_nice:+nice -n $_nice }\ | ${_nice:+nice -n $_nice }\ | ||||
| $_cpusetcmd \ | $_cpusetcmd \ | ||||
| $_setauditcmd \ | |||||
| ${_fib:+setfib -F $_fib }\ | ${_fib:+setfib -F $_fib }\ | ||||
| ${_env:+env $_env }\ | ${_env:+env $_env }\ | ||||
| chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ | chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ | ||||
| $_chroot $command $rc_flags $command_args" | $_chroot $command $rc_flags $command_args" | ||||
| else | else | ||||
| _cd="${_chdir:+cd $_chdir && }" | _cd="${_chdir:+cd $_chdir && }" | ||||
| _doit="\ | _doit="\ | ||||
| ${_fib:+setfib -F $_fib }\ | ${_fib:+setfib -F $_fib }\ | ||||
| ${_env:+env $_env }\ | ${_env:+env $_env }\ | ||||
| $_cpusetcmd $command $rc_flags $command_args" | $_cpusetcmd \ | ||||
| $_setauditcmd \ | |||||
| $command $rc_flags $command_args" | |||||
| if [ -n "$_user" ]; then | if [ -n "$_user" ]; then | ||||
| _doit="su -m $_user -c 'sh -c \"$_doit\"'" | _doit="su -m $_user -c 'sh -c \"$_doit\"'" | ||||
| fi | fi | ||||
| if [ -n "$_nice" ]; then | if [ -n "$_nice" ]; then | ||||
| if [ -z "$_user" ]; then | if [ -z "$_user" ]; then | ||||
| _doit="sh -c \"$_doit\"" | _doit="sh -c \"$_doit\"" | ||||
| fi | fi | ||||
| _doit="nice -n $_nice $_doit" | _doit="nice -n $_nice $_doit" | ||||
| ▲ Show 20 Lines • Show All 1,351 Lines • Show Last 20 Lines | |||||
style nit to match other entries in the list