X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sysv%2Fvprocunhide;fp=sysv%2Fvprocunhide;h=17a2cd43d45b303d3269184f564467d7a79dcb57;hb=8cf13bb177d92c93eb73dc8939777150536c2d00;hp=0000000000000000000000000000000000000000;hpb=6bf3f95de36c804c97716b2d0bdf10680c559044;p=util-vserver.git diff --git a/sysv/vprocunhide b/sysv/vprocunhide new file mode 100755 index 0000000..17a2cd4 --- /dev/null +++ b/sysv/vprocunhide @@ -0,0 +1,73 @@ +#!/bin/bash +# +# vprocunhide sets vserver related attributes for /proc +# +# chkconfig: 2345 26 74 +# description: Makes some /proc entries visibly for vservers + +: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars} +test -e "$UTIL_VSERVER_VARS" || { + echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2 + exit 1 +} +. "$UTIL_VSERVER_VARS" + +$_VSERVER_INFO - FEATURE iattr || exit 0 + +f=/etc/rc.d/init.d/functions +if test -e "$f"; then + . "$f" + lockfile=/var/lock/subsys/vprocunhide +else + success() { echo .; } + passed() { echo .; } + failure() { echo ERROR; } + lockfile=/var/run/vprocunhide +fi + + +function start() +{ + echo -n $"Fixing /proc entries visibility..." + $_VPROCUNHIDE + retval=$? + case "$retval" in + 0) success;; + 2) passed; retval=0;; + *) failure; + esac + echo + test "$retval" -ne 0 || touch "$lockfile" + return $retval +} + +function stop() +{ + rm -f "$lockfile" +} + +function restart() +{ + stop + start +} + +case "$1" in + start|stop|restart) $1;; + reload) ;; + condrestart) + test -f $lockfile && restart || : + ;; + status) + test -f $lockfile && { + echo $"/proc entries were fixed" + exit 0 + } + echo $"/proc entries are not fixed" + exit 1 + ;; + *) + echo "Usage: $0 {start|stop|reload|restart|condrestart|status}" + exit 2 + ;; +esac