Re: Systemd unit file executed as non-root user, WAS: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-11-17 Thread Richard Shaw
On Thu, Nov 17, 2011 at 3:56 PM, Richard Shaw hobbes1...@gmail.com wrote:
 On Thu, Nov 17, 2011 at 3:41 PM, Jeffrey Ollie j...@ocjtech.us wrote:
 On Thu, Nov 17, 2011 at 3:34 PM, Richard Shaw hobbes1...@gmail.com wrote:
 Ok, reviving this conversation!

 I ran into the issue that user mythtv can not create the file
 /var/run/mythbackend.pid. I see other services that have their pid
 file owned by their own user...

 systemd doesn't really need a PID file to manage the service, can
 mythtv be told not to create it?  If it insists on creating it see if
 you can move it to a subdirectory of /run (like /run/mythtv) that is
 owned by mythtv.

 Well PIDFile is recommended when using type forking. One option would
 be to drop the --daemon option and move to type simple.

I tried this and it appears to work.


 Also, user mythtv can't write to the log file in /var/log/mythtv/

 Change the ownership of /var/log/mythtv.

I added install -d -o mythtv -g mythtv /var/log/mythtv to %post for
the backend package. Is there a better way to do this?

Thanks,
Richard
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel

Re: Systemd unit file executed as non-root user, WAS: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-11-17 Thread Tom Hughes
On 17/11/11 22:09, Richard Shaw wrote:
 On Thu, Nov 17, 2011 at 3:56 PM, Richard Shawhobbes1...@gmail.com  wrote:
 On Thu, Nov 17, 2011 at 3:41 PM, Jeffrey Olliej...@ocjtech.us  wrote:
 On Thu, Nov 17, 2011 at 3:34 PM, Richard Shawhobbes1...@gmail.com  wrote:
 Ok, reviving this conversation!

 I ran into the issue that user mythtv can not create the file
 /var/run/mythbackend.pid. I see other services that have their pid
 file owned by their own user...

 systemd doesn't really need a PID file to manage the service, can
 mythtv be told not to create it?  If it insists on creating it see if
 you can move it to a subdirectory of /run (like /run/mythtv) that is
 owned by mythtv.

 Well PIDFile is recommended when using type forking. One option would
 be to drop the --daemon option and move to type simple.

 I tried this and it appears to work.

The other option is to create a file in /etc/tmpfiles.d that defines the 
/var/run/mythtv (or /run/mythtv) directory so that you can then write 
the PID file to it.

 Also, user mythtv can't write to the log file in /var/log/mythtv/

 Change the ownership of /var/log/mythtv.

 I added install -d -o mythtv -g mythtv /var/log/mythtv to %post for
 the backend package. Is there a better way to do this?

Yes! Create it in the %install section if the spec file and then add it 
to the files list.

Tom

-- 
Tom Hughes (t...@compton.nu)
http://compton.nu/
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel