File: vmtouch.init

package info (click to toggle)
vmtouch 1.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 172 kB
  • sloc: ansic: 762; sh: 51; makefile: 23; perl: 16
file content (69 lines) | stat: -rw-r--r-- 1,405 bytes parent folder | download | duplicates (2)
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
#! /bin/sh
### BEGIN INIT INFO
# Provides:             vmtouch
# Required-Start:       $local_fs $remote_fs
# Required-Stop:        $local_fs $remote_fs
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Start vmtouch daemon
# Description:          Start vmtouch, the Virtual Memory Toucher
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/vmtouch
NAME=vmtouch
DESC=vmtouch

test -x $DAEMON || exit 0

# Override these default values in /etc/default/vmtouch
ENABLE_VMTOUCH=no
VMTOUCH_USER_GROUP=nobody:nogroup
VMTOUCH_FILES="/nonexistent"
VMTOUCH_OPTIONS="-d -l -m 1G"
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

. /lib/lsb/init-functions

do_start()
{
	if [ $ENABLE_VMTOUCH = yes ]; then
		start-stop-daemon --start --quiet --chuid $VMTOUCH_USER_GROUP --exec $DAEMON -- $VMTOUCH_OPTIONS $VMTOUCH_FILES
		echo "$NAME."
	else
		echo "$NAME disabled in /etc/default/vmtouch"
	fi
}

do_stop()
{
	start-stop-daemon --stop --quiet --exec $DAEMON
}

case "$1" in
	start)
		echo -n "Starting: "
		do_start
		;;
	stop)
		echo -n "Stopping: "
		do_stop
		echo "$NAME."
		;;
	restart|force-reload)
		echo -n "Restarting: "
		do_stop
		sleep 1
		do_start
		;;
	status)
		status_of_proc $DAEMON $NAME
		;;
	*)
		N=/etc/init.d/$NAME
		echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
		exit 1
		;;
esac

exit 0