[package] start mpd normally, patch from Stefan Monnier
[packages.git] / sound / mpd / files / mpd.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2007 OpenWrt.org
3 START=93
4
5 start() {
6         #create mpd directories
7         pld=`grep playlist_directory /etc/mpd.conf | cut -d "\"" -f 2 | sed "s/~/\/root/g"`
8         if [ ! -d $pld ]; then
9                 mkdir -p $pld
10         fi
11         # Set the initial volume to something manageable
12         amixer set PCM 40
13
14         #start mpd
15         if [ -x /bin/nice ]; then
16                 # This has real-time constraints, so let's at least tell the OS
17                 # that this should have higher priority to avoid skipping
18                 # when doing other things in the background.
19                 nice="nice -n -10"
20         fi
21         $nice /usr/bin/mpd
22 }
23
24 stop() {
25         killall mpd
26 }