Artix Linux Forum

Artix Linux => Applications & Software => Topic started by: mangotree on 29 August 2018, 17:17:25

Title: mpd with openrc
Post by: mangotree on 29 August 2018, 17:17:25
I installed mpd and mpd-runit. but there is no openrc service to start it.

How can I start mpd with openRC
Title: Re: mpd with openrc
Post by: phoenix_king_rus on 29 August 2018, 17:41:12
Just write OpenRC script basing on runit one. You just need to put that commands in start function (without --no-daemon option) and add some depend function
Title: Re: mpd with openrc
Post by: nous on 29 August 2018, 21:16:59
Or get the script contributed here (https://forum.artixlinux.org/index.php/topic,276.0.html) and convert the systemd service.
Title: Re: mpd with openrc
Post by: mangotree on 30 August 2018, 09:01:25
Thank you guys.

first of I am still learning about these init script so please pardon advanced beginner questions

I found the script in a reddit post Here (https://www.reddit.com/r/linuxquestions/comments/348c0l/mpd_autostart_with_systemd/cqsf6sb)

with the systemd script

Code: [Select]
[Unit]
Description=Music Player Daemon
After=network.target sound.target

[Service]
User=mpd
ExecStart=/usr/bin/mpd --no-daemon
LimitRTPRIO=50
LimitRTTIME=-1
ControlGroup=cpu:/mpd
ControlGroupAttribute=cpu.rt_runtime_us 500000

[Install]
WantedBy=default.target

and the runit on

Code: [Select]
 
#!/bin/sh
 MPDCONF=/etc/mpd.conf
 exec mpd --stdout --no-daemon $MPDCONF

If I understand correctly it should look like.

Code: [Select]
#!/sbin/openrc-run
 
name=mpd
command="mpd --stdout  /home/{user}/.config/mpd/mpd.conf"


or

Code: [Select]
#!/sbin/openrc-run

command=/usr/bin/mpd
pidfile=

name="mpdSysd"
description="Music Player Daemon"


 is this correct and where does this file need to go? I believe it is supposed to go here

/etc/init.d


Title: Re: mpd with openrc
Post by: konimex on 30 August 2018, 15:43:43
Actually, Gentoo already has its own mpd initscript (https://github.com/gentoo/gentoo/blob/master/media-sound/mpd/files/mpd-0.20.4.init), so you don't need to convert systemd/runit service files to OpenRC ones.