View | Details | Raw Unified | Return to bug 123222 | Differences between
and this patch

Collapse All | Expand All

(-)rc.subr (-3 / +18 lines)
Lines 423-428 Link Here
423
#
423
#
424
#	${name}_nice	n	Nice level to run ${command} at.
424
#	${name}_nice	n	Nice level to run ${command} at.
425
#
425
#
426
#	${name}_rtprio	n	Realtime scheduling priority to run ${command} at.
427
#
428
#	${name}_idprio	n	Idletime scheduling priority to run ${command} at.
429
#
426
#	${name}_user	n	User to run ${command} as, using su(1) if not
430
#	${name}_user	n	User to run ${command} as, using su(1) if not
427
#				using ${name}_chroot.
431
#				using ${name}_chroot.
428
#				Requires /usr to be mounted.
432
#				Requires /usr to be mounted.
Lines 591-597 Link Here
591
	fi
595
	fi
592
	eval _chdir=\$${name}_chdir	_chroot=\$${name}_chroot \
596
	eval _chdir=\$${name}_chdir	_chroot=\$${name}_chroot \
593
	    _nice=\$${name}_nice	_user=\$${name}_user \
597
	    _nice=\$${name}_nice	_user=\$${name}_user \
594
	    _group=\$${name}_group	_groups=\$${name}_groups
598
	    _group=\$${name}_group	_groups=\$${name}_groups \
599
	    _rtprio=\$${name}_rtprio	_idprio=\$${name}_idprio
595
600
596
	if [ -n "$_user" ]; then	# unset $_user if running as that user
601
	if [ -n "$_user" ]; then	# unset $_user if running as that user
597
		if [ "$_user" = "$(eval $IDCMD)" ]; then
602
		if [ "$_user" = "$(eval $IDCMD)" ]; then
Lines 662-667 Link Here
662
			if [ -n "$_chroot" ]; then
667
			if [ -n "$_chroot" ]; then
663
				_doit="\
668
				_doit="\
664
${_nice:+nice -n $_nice }\
669
${_nice:+nice -n $_nice }\
670
${_rtprio:+rtprio $_rtprio }\
671
${_idprio:+idprio $_idprio }\
665
chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
672
chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
666
$_chroot $command $rc_flags $command_args"
673
$_chroot $command $rc_flags $command_args"
667
			else
674
			else
Lines 671-682 Link Here
671
				if [ -n "$_user" ]; then
678
				if [ -n "$_user" ]; then
672
				    _doit="su -m $_user -c 'sh -c \"$_doit\"'"
679
				    _doit="su -m $_user -c 'sh -c \"$_doit\"'"
673
				fi
680
				fi
674
				if [ -n "$_nice" ]; then
681
				if [ -n "$_nice$_rtprio$_idprio" ]; then
675
					if [ -z "$_user" ]; then
682
					if [ -z "$_user" ]; then
676
						_doit="sh -c \"$_doit\""
683
						_doit="sh -c \"$_doit\""
677
					fi	
684
					fi
685
				fi
686
				if [ -n "$_nice" ]; then
678
					_doit="nice -n $_nice $_doit"
687
					_doit="nice -n $_nice $_doit"
679
				fi
688
				fi
689
				if [ -n "$_rtprio" ]; then
690
					_doit="rtprio $_rtprio $_doit"
691
				fi
692
				if [ -n "$_idprio" ]; then
693
					_doit="idprio $_idprio $_doit"
694
				fi
680
			fi
695
			fi
681
696
682
					# run the full command
697
					# run the full command

Return to bug 123222