]> git.pld-linux.org Git - packages/util-vserver.git/blame_incremental - vprocunhide.init
- merge from AC-branch
[packages/util-vserver.git] / vprocunhide.init
... / ...
CommitLineData
1#!/bin/sh
2#
3# vprocunhide sets vserver related attributes for /proc
4#
5# chkconfig: 2345 26 74
6# description: Makes some /proc entries visibly for vservers
7
8# if kernel not capable, exit early
9if [ ! -d /proc/virtual ]; then
10 case "$1" in
11 start|stop|reload|restart)
12 exit 0
13 ;;
14 esac
15fi
16
17# Source function library.
18. /etc/rc.d/init.d/functions
19
20[ -n "$UTIL_VSERVER_VARS" ] || UTIL_VSERVER_VARS=/usr/lib/util-vserver/util-vserver-vars
21if [ ! -e "$UTIL_VSERVER_VARS" ] ; then
22 echo "Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
23 exit 1
24fi
25. "$UTIL_VSERVER_VARS"
26
27start() {
28 show "Fixing vservers /proc entries visibility"
29 busy
30 ${_SETATTR} -Rx --hide /proc 2>/dev/null
31 $_VPROCUNHIDE
32 RETVAL=$?
33 deltext
34 case "$RETVAL" in
35 0) ok;;
36 2) ok; RETVAL=0;;
37 *) fail;;
38 esac
39 [ "$RETVAL" -eq 0 ] && touch /var/lock/subsys/vprocunhide
40}
41
42stop() {
43 # XXX why start and stop both do --hide?
44 show "Stopping vservers /proc entries visibility"
45 busy
46 ${_SETATTR} -Rx --hide /proc 2>/dev/null
47 rm -f /var/lock/subsys/vprocunhide
48 ok
49}
50
51case "$1" in
52start|restart|reload)
53 start
54 ;;
55stop)
56 stop
57 ;;
58status)
59 if [ -f /var/lock/subsys/vprocunhide ] ; then
60 echo "vservers /proc entries were fixed"
61 else
62 echo "vservers /proc entries were not fixed"
63 fi
64 ;;
65*)
66 msg_usage "$0 {start|stop|reload|restart|status}"
67 exit 3
68 ;;
69esac
70
71exit $RETVAL
This page took 0.029363 seconds and 4 git commands to generate.