Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 246277 Details for
Bug 310511
sys-apps/preload: init.d script is not POSIX shell compliant
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Diff against the original script
0001-Fix-the-issues-with-the-init.d-script.patch (text/plain), 2.92 KB, created by
Michał Górny
on 2010-09-06 16:41:56 UTC
(
hide
)
Description:
Diff against the original script
Filename:
MIME Type:
Creator:
Michał Górny
Created:
2010-09-06 16:41:56 UTC
Size:
2.92 KB
patch
obsolete
>From e8bcf61e2c7f3860723bf48a536d43ac91c7860e Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl> >Date: Mon, 6 Sep 2010 18:37:20 +0200 >Subject: [PATCH] Fix the issues with the init.d script. > >The script has been made POSIX compliant. The race condition related to >ionice use has been fixed. Additional error handling has been added. >Script and command definitions for OpenRC have been added. >--- > preload | 60 ++++++++++++++++++++++++++++++++++++++---------------------- > 1 files changed, 38 insertions(+), 22 deletions(-) > >diff --git a/preload b/preload >index a5edb22..8a63519 100755 >--- a/preload >+++ b/preload >@@ -1,5 +1,10 @@ > #!/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() { >@@ -8,43 +13,54 @@ depend() { > } > > dump() { >- ebegin "Dumping config and state for preload" >- kill -USR1 $(<${PIDFILE}) >- kill -USR2 $(<${PIDFILE}) >- eend $? >+ 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 $(<${PIDFILE}) >- eend $? >+ 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 > >- # 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 /usr/sbin/preload -- \ >- -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 $? >+ # 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 while)" >+ ebegin "Stopping preload (this may take a while)" > start-stop-daemon --stop --retry 120 --quiet --pidfile ${PIDFILE} >- eend $? >+ eend ${?} > } >-- >1.7.2.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 310511
:
244507
|
246276
| 246277