public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in sys-apps/preload/files: preload-0.6.4.init.in-r1
@ 2010-09-07 12:11 Pacho Ramos (pacho)
  0 siblings, 0 replies; only message in thread
From: Pacho Ramos (pacho) @ 2010-09-07 12:11 UTC (permalink / raw
  To: gentoo-commits

pacho       10/09/07 12:11:06

  Added:                preload-0.6.4.init.in-r1
  Log:
  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.
  (Portage version: 2.1.8.3/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  sys-apps/preload/files/preload-0.6.4.init.in-r1

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
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

Index: preload-0.6.4.init.in-r1
===================================================================
#!/sbin/runscript

description='Start/stop the preload daemon'
extra_started_commands='dump reload'
description_dump='Dump the config and state of the daemon (to the logfile)'
description_reload='Reload the daemon'

PIDFILE="/var/run/preload.pid"

depend() {
	after localmount
	use netmount ntpd
}

dump() {
	local pid
	pid=$(cat ${PIDFILE})

	ebegin "Dumping the config and state of preload"
	if [ -n "${pid}" ]; then
		kill -USR1 ${pid}
		kill -USR2 ${pid}
	fi
	eend ${?} && \
	einfo "These should have been written to ${PRELOAD_LOGFILE:-/var/log/preload.log}"
}

reload() {
	ebegin "Reloading preload"
	kill -HUP $(cat ${PIDFILE})
	eend ${?}
}

start() {
	local ionice

	ebegin "Starting preload"

	#MIN_MEMORY=${MIN_MEMORY:-256}
	# Check for > MIN_MEMORY MB
	#free -m | awk '/Mem:/ {exit ($2 >= ('"$MIN_MEMORY"'))?0:1}' || exit 0

	# First try to start with ionice; if that fails, try without.
	for ionice in "ionice ${IONICE_OPTS:--c3}" ''; do
		# Avoid 'ionice not found' errors
		${ionice:-true} >/dev/null 2>&1 || continue

		${ionice} start-stop-daemon --start --quiet --background \
			--make-pidfile --pidfile ${PIDFILE} \
			--exec /usr/sbin/preload -- \
			-l ${PRELOAD_LOGFILE:-/var/log/preload.log} \
			-V ${PRELOAD_VERBOSITY:-1} \
			-n ${PRELOAD_NICE:-15} \
			-s ${PRELOAD_STATEFILE:-""} \
			${PRELOAD_OPTS} -f \
			&& break
	done

	eend ${?}
}

stop() {
	ebegin "Stopping preload (this may take a while)"
	start-stop-daemon --stop --retry 120 --quiet --pidfile ${PIDFILE}
	eend ${?}
}






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-09-07 12:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-07 12:11 [gentoo-commits] gentoo-x86 commit in sys-apps/preload/files: preload-0.6.4.init.in-r1 Pacho Ramos (pacho)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox