]> git.pld-linux.org Git - packages/util-vserver.git/blob - vprocunhide.init
- need to search for rpm binary it is present
[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/lib/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 start() {
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
42 stop() {
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
51 case "$1" in
52 start|restart|reload)
53         start
54         ;;
55 stop)
56         stop
57         ;;
58 status)
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         ;;
69 esac
70
71 exit $RETVAL
This page took 0.042897 seconds and 3 git commands to generate.