修改 /etc/init.d/mpd
sudo mpd --no-daemon --stdout 提示无法正确解析 /var/lib/mpd/state
--no-daemon don't detach from console
--stdout print messages to stdout and stderr
sudo vim /var/lib/mpd/state
audio_device_state:1:default detected output
state: stop
random: 0
repeat: 0
crossfade: 0
playlist_begin
一是playlist_begin 这行给删了 , 二是在最后一行加上 playlist_end
正确格式为
] $ cat state
audio_device_state:1:default detected output
state: stop
random: 0
repeat: 0
crossfade: 0
playlist_begin
0:music/动力火车/那就这样吧.mp3
1:music/潘多拉/Coboy come form hell.MP3
2:music/潘多拉/bad.mpg
3:music/潘多拉/gates.mp3
4:music/潘多拉/gg.mp3
playlist_end
这时重启mpd
$ sudo /etc/init.d/mpd restart
mpd | * Caching service dependencies ... [ ok ]
mpd | * Stopping Music Player Daemon ...
mpd |
mpd |** ERROR **: unable to open pid_file "/var/run/mpd/mpd.pid": No such file or directory
mpd |
mpd |aborting...
mpd |/etc/init.d/mpd: line 28: 828 已放弃 /usr/bin/mpd --kill /etc/mpd.conf [ !! ]
解决办法,先sudo vim /etc/init.d/mpd ,在 28行mpd --kill 后面加上一句 echo "stop" ,然后就可以正常的restart 了,这时再把刚加入的 echo "stop" 删了,其实目的是为了能让 $? 值返回成功,表示正确执行stop,但因为之前start时mpd已失败退出,根本就没这个进程,所以kill 要失败
转载于:https://blog.51cto.com/axlrose/1288934