Hello Romain,

I'm currently using the following SystemD service, placed in /usr/lib/systemd/system/[email protected]
[Unit]
Description=Liquidsoap service for channel %I
Documentation=man:liquidsoap(1)
After=network.target
ConditionPathExists=/etc/liquidsoap/%I.liq

[Service]
Type=simple
ExecStart=/usr/bin/liquidsoap --quiet /etc/liquidsoap/%I.liq
ExecReload=/bin/kill -USR1 $MAINPID
User=liquidsoap
Group=liquidsoap

[Install]
WantedBy=multi-user.target

Notice the following things:
* the SystemD service launches liquidsoap under the user and group defined in the service file, liquidsoap and liquidsoap
* distribution packages put their services in /usr/lib/systemd/system
* custom SystemD services are placed in /etc/systemd/system
* the at sign in the service is what makes SystemD so interesting for liquidsoap. It means that everything placed behind the @ sign is sent to liquidsoap as a parameter. starting [email protected] executes liquidsoap --quiet /etc/liquidsoap/foo.liq, starting liquidsoap@biguglytest executes liquidsoap --quiet /etc/liquidsoap/biguglytest.liq. in other words, %I in the service file is replaced by everything you put after the @ sign. I suggest reading the SystemD manpages for more info. example: when putting a file called foo.liq in /etc/liquidsoap, you have the following options:
- systemctl start [email protected]: starts the foo script
- systemctl stop [email protected]: stops the foo script
- systemctl restart [email protected]: restarts the foo script
- systemctl reload [email protected]: sends an USR1 signal to the liquidsoap process - systemctl enable [email protected]: starts the foo script at boot time - systemctl disable [email protected]: disable starting the foo script at boot time - systemctl status [email protected]: Gives the status of the liquidsoap service for channel foo Unlike with de debian init.d script, this SystemD service allows way more control over which liquidsoap script (channel) is running and which one isn't. The debian script runs everything in /etc/liquidsoap at ones, with this SystemD service you will have to start and stop every channel manually. So, a disadvantage is that it requires more work since you have to enable every channel separately, a big advantage is that you have separate control over every channel.

I hope this helps, feel free to include this service in your rrepository. I suggest adding a --systemd-dir configure option to the configure script which is disabled by default and which, when given without a parameter, defaults to /etc/systemd/system. In my arch build of liquidsoap, i'd use --systemd-dir=/usr/lib/systemd/system

Leonard
[Unit]
Description=Liquidsoap service for channel %I
Documentation=man:liquidsoap(1)
After=network.target
ConditionPathExists=/etc/liquidsoap/%I.liq

[Service]
Type=simple
ExecStart=/usr/bin/liquidsoap --quiet /etc/liquidsoap/%I.liq
ExecReload=/bin/kill -USR1 $MAINPID
User=liquidsoap
Group=liquidsoap

[Install]
WantedBy=multi-user.target

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to