]> git.pld-linux.org Git - packages/util-vserver.git/blob - vprocunhide.init
- up to pre3000
[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 $_VSERVER_INFO - FEATURE iattr || exit 0
30
31 start() {
32         show "Fixing vservers /proc entries visibility"
33         busy
34         $_VPROCUNHIDE
35         RETVAL=$?
36         deltext
37         case "$RETVAL" in
38                 0)      ok;;
39                 2)      ok; RETVAL=0;;
40                 *)      fail;;
41         esac
42         [ "$RETVAL" -eq 0 ] && touch /var/lock/subsys/vprocunhide
43 }
44
45 stop() {
46         show "Stopping vservers /proc entries visibility"
47         busy
48         rm -f /var/lock/subsys/vprocunhide
49         ok
50 }
51
52 case "$1" in
53   start|restart|reload)
54         start
55         ;;
56   stop)
57         stop
58         ;;
59   status)
60         if [ -f /var/lock/subsys/vprocunhide ]; then
61                 echo "vservers /proc entries were fixed"
62         else
63                 echo "vservers /proc entries were not fixed"
64         fi
65         ;;
66   *)
67         msg_usage "$0 {start|stop|reload|restart|status}"
68         exit 3
69         ;;
70 esac
71
72 exit $RETVAL
This page took 0.102499 seconds and 3 git commands to generate.