Gentoo Archives: gentoo-commits

From: "Pacho Ramos (pacho)" <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-apps/preload/files: preload-0.6.4.init.in-r1
Date: Tue, 07 Sep 2010 12:11:09
Message-Id: 20100907121106.2A9DB20054@flycatcher.gentoo.org
1 pacho 10/09/07 12:11:06
2
3 Added: preload-0.6.4.init.in-r1
4 Log:
5 Revision bump to fix race condition (bug #299140 by Ambroz Bizjak) and make it POSIX compliant (bug #310511 by Michał Górny), thanks a lot to Michał for providing the new init.d script.
6 (Portage version: 2.1.8.3/cvs/Linux x86_64)
7
8 Revision Changes Path
9 1.1 sys-apps/preload/files/preload-0.6.4.init.in-r1
10
11 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/preload/files/preload-0.6.4.init.in-r1?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/preload/files/preload-0.6.4.init.in-r1?rev=1.1&content-type=text/plain
13
14 Index: preload-0.6.4.init.in-r1
15 ===================================================================
16 #!/sbin/runscript
17
18 description='Start/stop the preload daemon'
19 extra_started_commands='dump reload'
20 description_dump='Dump the config and state of the daemon (to the logfile)'
21 description_reload='Reload the daemon'
22
23 PIDFILE="/var/run/preload.pid"
24
25 depend() {
26 after localmount
27 use netmount ntpd
28 }
29
30 dump() {
31 local pid
32 pid=$(cat ${PIDFILE})
33
34 ebegin "Dumping the config and state of preload"
35 if [ -n "${pid}" ]; then
36 kill -USR1 ${pid}
37 kill -USR2 ${pid}
38 fi
39 eend ${?} && \
40 einfo "These should have been written to ${PRELOAD_LOGFILE:-/var/log/preload.log}"
41 }
42
43 reload() {
44 ebegin "Reloading preload"
45 kill -HUP $(cat ${PIDFILE})
46 eend ${?}
47 }
48
49 start() {
50 local ionice
51
52 ebegin "Starting preload"
53
54 #MIN_MEMORY=${MIN_MEMORY:-256}
55 # Check for > MIN_MEMORY MB
56 #free -m | awk '/Mem:/ {exit ($2 >= ('"$MIN_MEMORY"'))?0:1}' || exit 0
57
58 # First try to start with ionice; if that fails, try without.
59 for ionice in "ionice ${IONICE_OPTS:--c3}" ''; do
60 # Avoid 'ionice not found' errors
61 ${ionice:-true} >/dev/null 2>&1 || continue
62
63 ${ionice} start-stop-daemon --start --quiet --background \
64 --make-pidfile --pidfile ${PIDFILE} \
65 --exec /usr/sbin/preload -- \
66 -l ${PRELOAD_LOGFILE:-/var/log/preload.log} \
67 -V ${PRELOAD_VERBOSITY:-1} \
68 -n ${PRELOAD_NICE:-15} \
69 -s ${PRELOAD_STATEFILE:-""} \
70 ${PRELOAD_OPTS} -f \
71 && break
72 done
73
74 eend ${?}
75 }
76
77 stop() {
78 ebegin "Stopping preload (this may take a while)"
79 start-stop-daemon --stop --retry 120 --quiet --pidfile ${PIDFILE}
80 eend ${?}
81 }