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