Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Oct 2011 19:53:42 GMT
From:      Mathieu <sigsys@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/161401: have service(8) run scripts with the same resource limits as init(8)
Message-ID:  <201110081953.p98Jrgh8091532@red.freebsd.org>
Resent-Message-ID: <201110082000.p98K04Kn018899@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         161401
>Category:       bin
>Synopsis:       have service(8) run scripts with the same resource limits as init(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 08 20:00:04 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Mathieu
>Release:        8.2-STABLE r225884M
>Organization:
>Environment:
>Description:
init(8) runs /etc/rc (and /etc/rc.shutdown) with the resource limits of the "daemon" class. But starting/restarting a service with service(8) will lose those limits and the service will inherit the limits of the user issuing the command.

This feature doesn't seem well documented, but still I think it would make sense for service to do the same thing as init.

>How-To-Repeat:

>Fix:
Index: usr.sbin/service/service.sh
===================================================================
--- usr.sbin/service/service.sh	(revision 225884)
+++ usr.sbin/service/service.sh	(working copy)
@@ -110,7 +110,7 @@
 for dir in /etc/rc.d $local_startup; do
 	if [ -x "$dir/$script" ]; then
 		[ -n "$VERBOSE" ] && echo "$script is located in $dir"
-		exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin $dir/$script $*
+		exec limits -C daemon -E HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin $dir/$script $*
 	fi
 done
 

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110081953.p98Jrgh8091532>