Some way to force MPD to save state without killing it

Discuss client development (or even MPD development if you feel so inclined), ask questions about the client libs, MPD feature requests from client developers, etc...
Post Reply
ernesto
Posts: 3
Joined: February 19th, 2014, 8:07 pm

Some way to force MPD to save state without killing it

Post by ernesto » February 19th, 2014, 8:15 pm

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.

max
Forum team
Posts: 940
Joined: January 15th, 2013, 3:43 pm

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

Post by max » February 19th, 2014, 8:19 pm

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.)

ernesto
Posts: 3
Joined: February 19th, 2014, 8:07 pm

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

Post by ernesto » February 19th, 2014, 9:30 pm

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.

max
Forum team
Posts: 940
Joined: January 15th, 2013, 3:43 pm

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

Post by max » February 20th, 2014, 8:14 am

It already is.

ernesto
Posts: 3
Joined: February 19th, 2014, 8:07 pm

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

Post by ernesto » February 20th, 2014, 11:55 am

Great! And where can I read about it?

max
Forum team
Posts: 940
Joined: January 15th, 2013, 3:43 pm

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

Post by max » February 20th, 2014, 6:17 pm

Actually, it's not configurable. MPD saves the state file every 5 minutes (hard-coded).

Post Reply