]> git.pld-linux.org Git - packages/util-vserver.git/blame_incremental - vprocunhide.init
- no attr(-,...)
[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# $Id$
9
10# if kernel not capable, exit early
11if [ ! -d /proc/virtual ]; then
12 case "$1" in
13 start|stop|reload|restart)
14 exit 0
15 ;;
16 esac
17fi
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
23if [ ! -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
26fi
27. "$UTIL_VSERVER_VARS"
28
29start() {
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
44stop() {
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
53case "$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 ;;
71esac
72
73exit $RETVAL
This page took 0.051439 seconds and 4 git commands to generate.