ready for tagging
[util-vserver.git] / 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 (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
11     exit 1
12 }
13 . "$UTIL_VSERVER_VARS"
14
15 $_VSERVER_INFO - FEATURE iattr || exit 0
16
17 LOCKFILE=vprocunhide
18 . "$_LIB_VSERVER_INIT_FUNCTIONS"
19
20
21 function start()
22 {
23     _beginResult $"Fixing /proc entries visibility"
24     $_VPROCUNHIDE
25     _endResult $?
26     local retval=$?
27     test "$retval" -ne 0 || touch "$lockfile"
28     return $retval
29 }
30
31 function stop()
32 {
33     $_RM -f "$lockfile"
34 }
35
36 function restart()
37 {
38     stop
39     start
40 }
41
42 case "$1" in
43     start|stop|restart) $1;;
44     reload)             ;;
45     condrestart)
46         test -f $lockfile && restart || :
47         ;;
48     status)
49         test -f $lockfile && {
50             echo $"/proc entries were fixed"
51             exit 0
52         }
53         echo $"/proc entries are not fixed"
54         exit 1
55         ;;
56     *)
57         echo "Usage: $0 {start|stop|reload|restart|condrestart|status}"
58         exit 2
59         ;;
60 esac