Following on 'Myoptik's post' (http://forums.slimdevices.com/showthread.php?98152-HOWTO-Install-squeezelite-for-logitech-media-server-on-Debian-Squeeze-as-a-service) I decided to bite the bullet and try to improve my current squeezelite launch script.
What I attach should work on debian squeeze and I suppose any distro using the start-stop-daemon facility. The script concept comes from the openVPN init script, which is designed to launch many VPN configs at once, and also allows to stop/start instances one by one: - There is a master script in /etc/init/ - It seeks for <player>.conf files in /etc/default/squeezelite/ - It sources each file and launches the executable according to the specific configuration. I have added some feeble checks: do not accept launching 2 config files specifying the same MAC address, do not accept launching a player trying to get exclusive access on an Alsa device already in use, do not accept launching 2 config files specifying the same log file. Also, in a player config file you can call further scripts, based on the "start" or "stop" contextual information passed on when the player config is invoked by the main script. I use this to tweak some parameters on the server (PCI devices latencies, IRQ prioritiesÂ…) before the player is launched, and reset them to standard once the instance has been stopped. The script uses variables, like "$SL_NAME", which are mapped to squeezelite command line switches, i.e. "-n $SL_NAME". So when Triode brings to us a great new version of Squeezelite, you could need to adapt the main script and player configs to take into account new command-line switches. This is written in sh, god knows why. Feel free to improve on it ;) Attached, a zip with 3 files: a) main script (on my machine, this is located at: /etc/init.d/squeezelite) b) minimal player config file, with all variables documented. (on my machine: /etc/default/squeezelite/skel_conf -- _conf in place of .conf to avoid the file being reaped by the script.) c) real-life player config file, with many variables used. (on my machine: /etc/default/squeezelite/prades.conf) HTH 14580 +-------------------------------------------------------------------+ |Filename: squeezelite-init.zip | |Download: http://forums.slimdevices.com/attachment.php?attachmentid=14580| +-------------------------------------------------------------------+ ------------------------------------------------------------------------ epoch1970's Profile: http://forums.slimdevices.com/member.php?userid=16711 View this thread: http://forums.slimdevices.com/showthread.php?t=98261
_______________________________________________ unix mailing list [email protected] http://lists.slimdevices.com/mailman/listinfo/unix
