You are not logged in.
I have an mpd server running in our store so we can play music from the internet over our hi-fi. It works great all day, however, when we come back in the morning, the audio is "skipping" like a perpetual underbuffer. I believe that the reason lies with the station we're tuned into - I think they disconnect listeners sometime in the night.
So what I need to do is shut down mpd and restart it at 5AM or something like that (unless you guys know of a better way to fix this). How would I be able to do this?
Offline
write a quick cron job to bring mpd down and back up
Offline
How would one do that?
I see that there are easily editable cron configs in /etc, but how would I make it restart at 5AM specifically?
Offline
$ man crontab
Offline
Crontab, nice. How's this look?
#
# DO NOT EDIT THIS FILE MANUALLY!! USE crontab -e INSTEAD.
#
# <minute> <hour> <day> <month> <dow> <command>
01 * * * * /usr/sbin/run-cron /etc/cron.hourly
02 00 * * * /usr/sbin/run-cron /etc/cron.daily
22 00 * * 0 /usr/sbin/run-cron /etc/cron.weekly
42 00 1 * * /usr/sbin/run-cron /etc/cron.monthly
00 5 * * * mpd --kill
01 5 * * * mpdOffline
Crontab, nice. How's this look?
# # DO NOT EDIT THIS FILE MANUALLY!! USE crontab -e INSTEAD. # # <minute> <hour> <day> <month> <dow> <command> 01 * * * * /usr/sbin/run-cron /etc/cron.hourly 02 00 * * * /usr/sbin/run-cron /etc/cron.daily 22 00 * * 0 /usr/sbin/run-cron /etc/cron.weekly 42 00 1 * * /usr/sbin/run-cron /etc/cron.monthly 00 5 * * * mpd --kill 01 5 * * * mpd
You have to specify the path of mpd, change mpd to /usr/bin/mpd
Cheers Sigi
Haven't been here in a while. Still rocking Arch. ![]()
Offline
you could also use /etc/rc.d/mpd restart
Offline
you could also use /etc/rc.d/mpd restart
This is definitely the better option, so that would make it:
0 5 * * * /etc/rc.d/mpd restartOffline
You can also set xinetd to run mpd from hour X to Y and shut it down afterwards. Very handy, and imho more sohpisticated than a cron job
.
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
Got the cron job working, works great ![]()
How does xinetd work?
Offline