Ticket #2427: mpd

File mpd, 1.1 KB (added by Arthur Demchenkov, 17 years ago)

mpd init script

Line 
1#!/bin/sh
2# Begin $rc_base/init.d/mpd
3
4# Based on apache script from LFS-6.2.
5# Rewritten by Spinal - spinal.by@mail.ru
6
7#$Date: Sun Oct 22 05:24:50 EEST 2006 $
8
9. /etc/sysconfig/rc
10. $rc_functions
11MPD="/usr/bin/mpd"
12
13checkconfig() {
14 if ! [ -f /etc/mpd.conf ]; then
15 echo "Configuration file /etc/mpd.conf does not exist." >&2
16 return 1
17 fi
18}
19
20case "$1" in
21 start)
22 boot_mesg "Starting Music Player Daemon..."
23 checkconfig || { evaluate_retval ; exit 1 ; }
24 loadproc -n -1 $MPD --no-create-db /etc/mpd.conf
25 ;;
26
27 stop)
28 boot_mesg "Stopping Music Player Daemon..."
29 $MPD --kill 2>/dev/null
30 evaluate_retval
31 ;;
32
33 reload)
34 boot_mesg "Reloading Music Player Daemon..."
35 reloadproc $MPD
36 ;;
37
38 restart)
39 $0 stop
40 sleep 1
41 $0 start
42 ;;
43
44 status)
45 statusproc $MPD
46 ;;
47
48 updatedb)
49 boot_mesg "Updating database for Music Player Daemon..."
50 checkconfig || { evaluate_retval ; exit 1 ; }
51 $MPD --create-db /etc/mpd.conf
52 $0 reload
53 ;;
54
55 *)
56 echo "Usage: $0 {start|stop|reload|restart|status|updatedb}"
57 exit 1
58 ;;
59esac
60
61# End $rc_base/init.d/mpd