[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Re: init system policy



I've been fighting with some script conversion to systemd and I think a reasonnably complex exemple should be of great help. I've been trying to convert minidlna sysv init file to systemd, managed to have a working unit file but failed to split the configuration mimicing the ../default/minidlna content with the hability to make USER and GROUP configurable.

Each time iI try to  use:
[Unit]
Description=MiniDLNA is a DLNA/UPnP-AV server software
After=local-fs.target network.target

[Service]
EnvironmentFile=./etc/default/minidlna.conf.sysd
User=$USER_MINIDLNA (defined in the environment file)
Group=$GROUP_MINIDLNA (idem)
Type=simple
# drop root just before ExecStart to allow ExecStartPre to run as root
PermissionsStartOnly=true
#command that still needs root priviledge
ExecStartPre=/bin/mkdir -p /var/run/minidlna
ExecStartPre=/bin/chown $USER /var/run/minidlna
ExecStart=/usr/sbin/minidlnad -S

[Install]
WantedBy=multi-user.target

I get an error that is due to User setting. Putting a known user works!!! I have tryed USER_MINIDLNA=minidlna with or without quote as well as $USER_MINIDLNA or ${USER_MINIDLNA}

Thanks for the guide anyway.


-- eric


Reply to: