2
Mai
2005

MPD start script

#!/bin/bash
#
# mpd This script takes care of starting and stopping
# mpd (Music Player Deamon) server
#
# This script has been tested on redhat/fedora distribution and
# should run on other "system V" like Mandrake
#
# To get mpd please visite www.musicpd.org
# To get rpm package check at http://sourceforge.net
#
# Thank to schmandman (original script for BSD system)
#
# Installation
# 1) copy this script into /etc/init.d/
# 2) make this script executable ( chmod a-x /etc/init.d/mpd )
# 3) Create link to start mpd at the desired level (usually level 5)
# ln -s /etc/init.d/mpd /etc/rc.d/rc5.d/S99mpd
# 4) Create link to stop properly the deamon
# ln -s /etc/init.d/mpd /etc/rc.d/rc0.d/K99mpd
# ln -s /etc/init.d/mpd /etc/rc.d/rc1.d/K99mpd
# ln -s /etc/init.d/mpd /etc/rc.d/rc6.d/K99mpd
#

# Source function library.
. /etc/rc.d/init.d/functions

prog="Music Player Daemon"
configfile="/etc/mpd.conf"
daemonx="/usr/local/bin/mpd"
pid="/var/run/mpd.pid"

if [ ! -x $daemonx ]; then
echo -e "Fatal error: $daemonx not found"
return 1
fi

if [ ! -f $configfile ]; then
echo -e "Fatal Error: config file $configfile not found...exiting"
return 1
fi

music=`grep music_dir $configfile|cut -d " " -f2|sed -e 's/\"//g'`
if [ ! -d $music ]; then
echo -e "no music found\n why start?"
return 1
fi

start() {
echo -n $"Starting $prog: "
daemon $daemonx $configfile
ret=$?
echo
[ $ret -eq 0 ] && touch $pid
return $ret
}
stop() {
echo -n $"Stopping $prog: "
killproc $daemonx
ret=$?
echo
[ $ret -eq 0 ] && rm -f $pid
}
createdb() {
echo -n $"Create/Recreate db "
$daemonx --create-db
ret=$?
echo
[ $ret -eq 0 ] && touch $pid
return $ret
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $daemonx
ret=$?
;;
restart)
stop
start
;;
createdb)
stop
createdb
start
;;
*)
echo $"Usage: $0 {start|stop|status|createdb|restart}"
exit 1
esac

exit $?
logo

vireas

Suche

 

Aktuelle Beiträge

C i s c o  V...
can get always the latest version of C i s c o  V...
vireas - 12. Jul, 11:07
WM5: Custom text on today...
You can set a small custom text message on the bottom...
vireas - 15. Mai, 21:44
WM5: Increase Performance...
Boost Windows Mobile 5 performance up to 20 percent [HKLM\System\Stor ageManager\FATFS]...
vireas - 15. Mai, 21:42
WM5: Speed Up your Pocket...
This tweak might help improving visual performance...
vireas - 15. Mai, 21:41
Windows Ordner
-Es ist nicht möglich unter Windows einen Ordner anzulegen...
vireas - 22. Feb, 13:37

Archiv

Mai 2005
Mo
Di
Mi
Do
Fr
Sa
So
 
 
 
 
 
 
 1 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
11
12
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
 
 
 
 
 

Status

Online seit 7702 Tagen
Zuletzt aktualisiert: 12. Jul, 11:07
vireas-plug

KnowHow
KnowHow - Mobiles
Tools
Profil
Abmelden
Weblog abonnieren