summaryrefslogtreecommitdiff
path: root/dev-libs/libcgroup/files/cgred.initd
blob: d507e09a81548cf2fa55b31cf878027c01336635 (plain)
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
#!/sbin/openrc-run
#
# CGroups Rules Engine Daemon
#
# This is a daemon for automatically classifying processes into cgroups based
# on UID/GID.
#
opts="${opts} reload"

CGRULESENGD="/usr/sbin/cgrulesengd"
PID_FILE=${PID_FILE:-"/var/run/cgred.pid"}

depend() {
	need cgconfig
	use logger
}

start() {
	local options="${NODAEMON} ${LOG}"
	if [[ -n "${LOG_FILE}" ]]; then
		options="${options} --log-file=${LOG_FILE}"
	fi

	ebegin "Starting CGroup Rules Engine Daemon"
	start-stop-daemon --start --pidfile "${PID_FILE}" --make-pidfile \
		--background --exec "${CGRULESENGD}" -- ${options} >/dev/null
	eend $?
}

stop() {
	ebegin "Stopping CGroup Rules Engine Daemon"
	start-stop-daemon --stop --pidfile "${PID_FILE}" --exec "${CGRULESENGD}"
	eend $?
}

reload() {
	ebegin "Reloading CGroup Rules Engine Daemon"
	start-stop-daemon --stop --signal USR2 --oknodo --background \
		--pidfile "${PID_FILE}" --make-pidfile --exec "${CGRULESENGD}"
	eend $?
}