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