Page 1 of 1

Some way to force MPD to save state without killing it

Posted: February 19th, 2014, 8:15 pm
by ernesto
Hi,

I'd like to know if there is some way to force MPD to save state without killing it. From http://mpd.wikia.com/wiki/How_To_Create_a_State_File I can read that in prior versions this could be accomplished with SIGHUP, though I am using 0.16.8 and it doesn't work.

This feature is useful when using MPD in an embedded device, which is not supposed to be shut down properly and the mpd process is not going to receive any signal before powering off.

Regards.

Re: Some way to force MPD to save state without killing it

Posted: February 19th, 2014, 8:19 pm
by max
If you don't receive a signal before powering off, how is a signal that triggers state file save useful? I'd say: SIGTERM triggers that.

(Don't read the Wiki. It's obsolete because it's full of trash.)

Re: Some way to force MPD to save state without killing it

Posted: February 19th, 2014, 9:30 pm
by ernesto
Max,

thanks for the interest. The SIGTERM could be issued from a cron job for instance, and so the state could be saved once each minute. Or from a shell script, if you want smaller intervals.

By the way, perhaps this state saving by time interval could be a built in and configurable function of mpd, but in the meanwhile, saving on SIGTERM would do, I think.

Regards.

Re: Some way to force MPD to save state without killing it

Posted: February 20th, 2014, 8:14 am
by max
It already is.

Re: Some way to force MPD to save state without killing it

Posted: February 20th, 2014, 11:55 am
by ernesto
Great! And where can I read about it?

Re: Some way to force MPD to save state without killing it

Posted: February 20th, 2014, 6:17 pm
by max
Actually, it's not configurable. MPD saves the state file every 5 minutes (hard-coded).