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