initial checkin
[util-vserver.git] / util-vserver / sysv / vprocunhide
1 #!/bin/bash
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 : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
9 test -e "$UTIL_VSERVER_VARS" || {
10     echo $"Can not find util-vserver installation; aborting...">&2
11     exit 1
12 }
13 . "$UTIL_VSERVER_VARS"
14
15 # Source function library.
16 . /etc/rc.d/init.d/functions
17
18 lockfile=/var/lock/subsys/vprocunhide
19
20 function start()
21 {
22     echo -n $"Fixing /proc entries visibility..."
23     $_VPROCUNHIDE
24     rc=$?
25     case "$rc" in
26         0)      success;;
27         2)      rc=0; passed;;
28         *)      failure;
29     esac
30     echo
31     test "$rc" -ne 0 || touch "$lockfile"
32     return $rc
33 }
34
35 function stop()
36 {
37     rm -f "$lockfile"
38 }
39
40 function restart()
41 {
42     stop
43     start
44 }
45
46 case "$1" in
47     start|stop|restart) $1;;
48     reload)             ;;
49     condrestart)
50         test -f $lockfile && restart || :
51         ;;
52     status)
53         test -f $lockfile && {
54             echo $"/proc entries were fixed"
55             exit 0
56         }
57         echo $"/proc entries are not fixed"
58         exit 1
59         ;;
60     *)
61         echo "Usage: $0 {start|stop|reload|restart|condrestart|status}"
62         exit 2
63         ;;
64 esac
65
66