File: vprocunhide

package info (click to toggle)
util-vserver 0.30.204-5sarge3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 5,452 kB
  • ctags: 2,353
  • sloc: sh: 28,471; ansic: 15,138; xml: 1,334; cpp: 938; makefile: 334; perl: 85
file content (74 lines) | stat: -rwxr-xr-x 1,383 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
#
# vprocunhide  sets vserver related attributes for /proc
#
# chkconfig: 2345 26 74
# description: Makes some /proc entries visibly for vservers

: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
test -e "$UTIL_VSERVER_VARS" || {
    echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
    exit 1
}
. "$UTIL_VSERVER_VARS"

f=/etc/rc.d/init.d/functions
if test -e "$f"; then
    . "$f"
    lockfile=/var/lock/subsys/vprocunhide
else
    success() { echo .; }
    passed()  { echo .; }
    failure() { echo ERROR; }
    lockfile=/var/run/vprocunhide
fi


function start()
{
    echo -n $"Fixing /proc entries visibility..."
    $_VPROCUNHIDE
    retval=$?
    case "$retval" in
	0)	success;;
	2)	passed; retval=0;;
	*)	failure;
    esac
    echo
    test "$retval" -ne 0 || touch "$lockfile"
    return $retval
}

function stop()
{
    rm -f "$lockfile"
}

function restart()
{
    stop
    start
}

case "$1" in
    start|stop|restart)	$1;;
    reload)		;;
    force-reload)
        $0 restart
        ;;
    condrestart)
	test -f $lockfile && restart || :
	;;
    status)
	test -f $lockfile && {
	    echo $"/proc entries were fixed"
	    exit 0
	}
	echo $"/proc entries are not fixed"
	exit 1
	;;
    *)
        echo "Usage: $0 {start|stop|reload|restart|condrestart|status}"
	exit 2
	;;
esac