blob: d474afb930655baea9fe156f90515900b95c5cf5 (
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
42
43
44
45
46
47
48
49
50
|
#!/sbin/openrc-run
PIDFILE="/var/run/@PACKAGE@.pid"
depend() {
after localmount
use netmount ntpd
}
dump() {
ebegin "Dumping config and state for @PACKAGE@"
kill -USR1 $(<${PIDFILE})
kill -USR2 $(<${PIDFILE})
eend $?
}
reload() {
ebegin "Reloading @PACKAGE@"
kill -HUP $(<${PIDFILE})
eend $?
}
start() {
ebegin "Starting @PACKAGE@"
#MIN_MEMORY=${MIN_MEMORY:-256}
# Check for > MIN_MEMORY MB
#free -m | awk '/Mem:/ {exit ($2 >= ('"$MIN_MEMORY"'))?0:1}' || exit 0
# IMPORTANT: Let ssd do the backgrounding so we immediatly get a valid
# pid file in the next step (ionice)
start-stop-daemon --start --quiet --background \
--make-pidfile --pidfile ${PIDFILE} \
--exec @sbindir@/@PACKAGE@ -- \
-l ${PRELOAD_LOGFILE:-/var/log/preload.log} -V ${PRELOAD_VERBOSITY:-1} \
-n ${PRELOAD_NICE:-15} -s ${PRELOAD_STATEFILE:-""} ${PRELOAD_OPTS} -f
IONICE=$(which ionice)
if [ -x "$IONICE" ]; then
IONICE_OPTS=${IONICE_OPTS:--c3}
$IONICE ${IONICE_OPTS} -p$(<${PIDFILE})
fi
eend $?
}
stop() {
ebegin "Stopping @PACKAGE@ (this may take while)"
start-stop-daemon --stop --retry 120 --quiet --pidfile ${PIDFILE}
eend $?
}
|