Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 121288 Details for
Bug 181010
media-sound/mpd - new /etc/init.d/ script
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
new /etc/init.d/mpd
mpd (text/plain), 2.42 KB, created by
Zrajm C Akfohg
on 2007-06-05 21:27:43 UTC
(
hide
)
Description:
new /etc/init.d/mpd
Filename:
MIME Type:
Creator:
Zrajm C Akfohg
Created:
2007-06-05 21:27:43 UTC
Size:
2.42 KB
patch
obsolete
>#!/sbin/runscript ># Copyright 1999-2004 Gentoo Foundation ># Distributed under the terms of the GNU General Public License v2 ># $Header: /var/cvsroot/gentoo-x86/media-sound/mpd/files/mpd-0.12.rc6,v 1.3 2006/10/03 19:26:17 ticho Exp $ > >depend() { > need alsasound localmount > use netmount nfsmount esound pulseaudio >} > ># [2007-03-29, 21:11-01:36] - Zrajm C Akfohg modified this script so that it ># kills MPD. This works even when MPD has hanged (which, for some reason, ># happens to me quite frequently) while the traditional `mpd --kill' does not. > ># Usage: pschildren PID ># ># Lists process numbers of the immediate children of PID. Returns false if if ># no children were found. /zrajm [2007-03-30] >pschildren() { > awk -F/ ' > BEGIN { retval=1 } > /^PPid: '"$1"'$/ { > retval=0 > $0=FILENAME > print $3 > nextfile > } > END { exit retval } > ' /proc/[0-9]*/status > # Listing `/proc/scsi' (at least under some cirkumstances) never terminates > # on my system, so to avoid hanging this script, look only for "status" > # files which begins with a *number* (i.e. is a PID) above. /zrajm > # [2007-05-22] >} > ># Usage: pstree PID ># ># Lists process number of PID, and all its offspring processes. ># /zrajm [2007-03-30] >pstree() { > local PID > for PID in "$@"; do > echo "$PID" > pstree $(pschildren "$PID") > done >} > >checkconfig() { > if ! [ -f /etc/mpd.conf ]; then > eerror "Configuration file /etc/mpd.conf does not exist." > return 1 > fi > > return 0 >} > >start() { > checkconfig || return 1 > > # You may set mpd's by setting "NICENESS" in `/etc/conf.d/mpd' (default: 0) > # /zrajm [2007-06-04] > local NICENESS="$(( ${NICENESS:-0} - $(nice) ))" > ebegin "Starting Music Player Daemon" > nice --adjustment=$NICENESS /usr/bin/mpd --no-create-db /etc/mpd.conf > eend $? >} > >stop() { > ebegin "Stopping Music Player Daemon" > [[ -r /etc/mpd.conf ]] && > PIDFILE="$(awk -F'"' '/^ *pid_file/{ print $2; exit }' /etc/mpd.conf)" > if [[ -r "$PIDFILE" ]]; then > local PID KILLS="0" > for PID in $(pstree "$(cat $PIDFILE)"); do > [[ -d "/proc/$PID" ]] || continue > einfo " Killing MPD process $PID." > kill $PID && ((KILLS++)) > done > if (( KILLS > 1 )); then > ewarn "NOTE: More than one MPD process was killed!" > ewarn " (This normally does not happen, and usually means that" > ewarn " the now stopped MPD instance was non-responsive/hanged.)" > fi > else > /usr/bin/mpd --kill > fi > eend $? >}
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 Raw
Actions:
View
Attachments on
bug 181010
: 121288