Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-11-17 Thread Richard Shaw
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... Also, user mythtv can't write to the log file in /var/log/mythtv/ How do I do this with systemd? I

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-11-17 Thread Jeffrey Ollie
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

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-11-17 Thread Richard Shaw
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

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

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

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-21 Thread Toshio Kuratomi
On Wed, Oct 19, 2011 at 06:53:12PM -0500, Richard Shaw wrote: On Wed, Oct 19, 2011 at 6:34 PM, Lennart Poettering mzerq...@0pointer.de wrote: On Wed, 19.10.11 18:28, Richard Shaw (hobbes1...@gmail.com) wrote: Well, as I had already mentioned I more or less relented, so I'm all for the a/v

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-21 Thread Richard Shaw
On Fri, Oct 21, 2011 at 11:44 AM, Toshio Kuratomi a.bad...@gmail.com wrote: On Wed, Oct 19, 2011 at 06:53:12PM -0500, Richard Shaw wrote: You're right, an ACL approach may be better. But my sql-fu isn't really up to the task. For this to work: 1. mysqld would have to be running. 2. I would

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-20 Thread Jóhann B. Guðmundsson
On 10/19/2011 09:48 PM, Richard Shaw wrote: That will work for the user, however, I was also going to allow for additional options from the sysconfig file, but $OPTIONS wasn't being expand either. sysconfig files for daemons kinda is obsolete these days either write the daemon to parse a

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-20 Thread Jóhann B. Guðmundsson
On 10/19/2011 08:29 PM, Lennart Poettering wrote: The After=syslog.target is unnecessary these days and should be removed to keep things simple. If you expect upstream to ship unit files then you must realize that upstream needs to ship a unit file that works across distribution on what ever

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-20 Thread Richard Shaw
2011/10/20 Jóhann B. Guðmundsson johan...@gmail.com: On 10/19/2011 08:29 PM, Lennart Poettering wrote: The After=syslog.target is unnecessary these days and should be removed to keep things simple. If you expect upstream to ship unit files then you must realize  that upstream needs to ship a

Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Richard Shaw
It looks like I'll be taking over mythtv packaging for RPM Fusion and I noticed it still only uses a sysv init script. In the sysv script it sets some ACL permissions on video and audio devices necessary for the backend service, and then on shutdown changes it back. I don't see any way to

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Jochen Schmitt
Am 19.10.2011 20:43, schrieb Richard Shaw: ExecStart=/bin/sh /usr/libexec/mythtv/startmythbackend.sh ExecStop=/bin/sh /usr/libexec/mythtv/stopmythbackend.sh You don't need to specified /bin/sh if your script starts with a proper #!/bin/sh. Best Regards: Jochen Schmitt -- devel mailing list

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Jóhann B. Guðmundsson
On 10/19/2011 06:43 PM, Richard Shaw wrote: It looks like I'll be taking over mythtv packaging for RPM Fusion and I noticed it still only uses a sysv init script. In the sysv script it sets some ACL permissions on video and audio devices necessary for the backend service, and then on shutdown

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Richard Shaw
2011/10/19 Jóhann B. Guðmundsson johan...@gmail.com: This is what I wrote a while back for mythtv in rpmfusion but never submitted since I could not find someone to test it. Note this got picked up by someone and adapted to atrpm version the other day. Cant recall if that indvidual pinged

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Richard Shaw
Ok, I took Jóhann's idea and ran with it, trying to preserve as much of the functionality of the sysv init script as I could. It turn out the need to change device permissions is only for people who want to run mythbackend as a real user, not root. I'm not sure if the following is valid, but here

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Lennart Poettering
On Wed, 19.10.11 13:43, Richard Shaw (hobbes1...@gmail.com) wrote: It looks like I'll be taking over mythtv packaging for RPM Fusion and I noticed it still only uses a sysv init script. In the sysv script it sets some ACL permissions on video and audio devices necessary for the backend

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Lennart Poettering
On Wed, 19.10.11 14:21, Richard Shaw (hobbes1...@gmail.com) wrote: Ok, I took Jóhann's idea and ran with it, trying to preserve as much of the functionality of the sysv init script as I could. It turn out the need to change device permissions is only for people who want to run mythbackend

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Richard Shaw
On Wed, Oct 19, 2011 at 3:26 PM, Lennart Poettering mzerq...@0pointer.de wrote: You should manage acess control of device nodes from udev rules. That's the only reasonably safe way to handle these things. And this should not be mentioned at all in systemd unit files. Well, that's a bit beyond

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Tom Hughes
On 19/10/11 21:48, Richard Shaw wrote: On Wed, Oct 19, 2011 at 3:26 PM, Lennart Poettering mzerq...@0pointer.de wrote: You should manage acess control of device nodes from udev rules. That's the only reasonably safe way to handle these things. And this should not be mentioned at all in

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Kay Sievers
On Wed, Oct 19, 2011 at 22:26, Lennart Poettering mzerq...@0pointer.de wrote: On Wed, 19.10.11 13:43, Richard Shaw (hobbes1...@gmail.com) wrote: It looks like I'll be taking over mythtv packaging for RPM Fusion and I noticed it still only uses a sysv init script. In the sysv script it sets

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Kay Sievers
On Wed, Oct 19, 2011 at 23:20, Richard Shaw hobbes1...@gmail.com wrote: On Wed, Oct 19, 2011 at 3:58 PM, Tom Hughes t...@compton.nu wrote: On 19/10/11 21:48, Richard Shaw wrote: On Wed, Oct 19, 2011 at 3:26 PM, Lennart Poettering mzerq...@0pointer.de  wrote: You should manage acess control

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Tom Hughes
On 19/10/11 22:27, Kay Sievers wrote: On Wed, Oct 19, 2011 at 23:20, Richard Shawhobbes1...@gmail.com wrote: Ok based on Tom's file I came up with the following. I know Lennart, you don't like setting ACL's from Systemd, but unless someone want's to help me write udev rules that will run

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Richard Shaw
On Wed, Oct 19, 2011 at 4:27 PM, Kay Sievers kay.siev...@vrfy.org wrote: On Wed, Oct 19, 2011 at 23:20, Richard Shaw hobbes1...@gmail.com wrote: On Wed, Oct 19, 2011 at 3:58 PM, Tom Hughes t...@compton.nu wrote: On 19/10/11 21:48, Richard Shaw wrote: On Wed, Oct 19, 2011 at 3:26 PM, Lennart

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Adam Williamson
On Wed, 2011-10-19 at 16:35 -0500, Richard Shaw wrote: On Wed, Oct 19, 2011 at 4:27 PM, Kay Sievers kay.siev...@vrfy.org wrote: On Wed, Oct 19, 2011 at 23:20, Richard Shaw hobbes1...@gmail.com wrote: On Wed, Oct 19, 2011 at 3:58 PM, Tom Hughes t...@compton.nu wrote: On 19/10/11 21:48,

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Kay Sievers
On Wed, Oct 19, 2011 at 23:35, Richard Shaw hobbes1...@gmail.com wrote: On Wed, Oct 19, 2011 at 4:27 PM, Kay Sievers kay.siev...@vrfy.org wrote: On Wed, Oct 19, 2011 at 23:20, Richard Shaw hobbes1...@gmail.com wrote: On Wed, Oct 19, 2011 at 3:58 PM, Tom Hughes t...@compton.nu wrote: On

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Richard Shaw
On Wed, Oct 19, 2011 at 4:41 PM, Adam Williamson awill...@redhat.com wrote: I'd think best practice here would be for mythbackend package to create a mythbackend user which is a member of audio and video groups, and have the startup script run mythbackend as that user...would there be any

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Richard Shaw
On Wed, Oct 19, 2011 at 4:43 PM, Kay Sievers kay.siev...@vrfy.org wrote: On Wed, Oct 19, 2011 at 23:35, Richard Shaw hobbes1...@gmail.com wrote: That works for me. I wonder if I could use ExecStartPre to run a shell script to make sure the user is in those groups and write to stderr if not?

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Tom Hughes
On 19/10/11 22:34, Tom Hughes wrote: On 19/10/11 22:27, Kay Sievers wrote: Like mentioned earlier in this thread, just put the user into the audio/video system group and forget about any permissions management. My unit was based on a translation of the old init scripts but yes, it looks

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Rahul Sundaram
On 10/20/2011 03:18 AM, Richard Shaw wrote: That will work for the user, however, I was also going to allow for additional options from the sysconfig file, but $OPTIONS wasn't being expand either. Don't use a sysconfig file. Let the user copy the service file from lib to etc or use the

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Lennart Poettering
On Wed, 19.10.11 16:20, Richard Shaw (hobbes1...@gmail.com) wrote: On Wed, Oct 19, 2011 at 3:58 PM, Tom Hughes t...@compton.nu wrote: On 19/10/11 21:48, Richard Shaw wrote: On Wed, Oct 19, 2011 at 3:26 PM, Lennart Poettering mzerq...@0pointer.de  wrote: You should manage acess

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Lennart Poettering
On Wed, 19.10.11 23:43, Kay Sievers (kay.siev...@vrfy.org) wrote: Like mentioned earlier in this thread, just put the user into the audio/video system group and forget about any permissions management. That works for me. I wonder if I could use ExecStartPre to run a shell script to make

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Richard Shaw
On Wed, Oct 19, 2011 at 5:09 PM, Lennart Poettering mzerq...@0pointer.de wrote: On Wed, 19.10.11 16:20, Richard Shaw (hobbes1...@gmail.com) wrote: Ok based on Tom's file I came up with the following. I know Lennart, you don't like setting ACL's from Systemd, but unless someone want's to help

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Lennart Poettering
On Wed, 19.10.11 18:28, Richard Shaw (hobbes1...@gmail.com) wrote: On Wed, Oct 19, 2011 at 5:09 PM, Lennart Poettering mzerq...@0pointer.de wrote: On Wed, 19.10.11 16:20, Richard Shaw (hobbes1...@gmail.com) wrote: Ok based on Tom's file I came up with the following. I know Lennart, you

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Adam Williamson
On Wed, 2011-10-19 at 18:28 -0500, Richard Shaw wrote: In order to fix this retroactively, I would have to do an sql query using the login credentials for mythbackend and pull the recording groups, then go to each recording group directory and chown all the recordings. That's a mess. Yeah,

Re: Systemd unit file: Can/Should ExecStart and ExecStop run a script?

2011-10-19 Thread Richard Shaw
On Wed, Oct 19, 2011 at 6:34 PM, Lennart Poettering mzerq...@0pointer.de wrote: On Wed, 19.10.11 18:28, Richard Shaw (hobbes1...@gmail.com) wrote: Well, as I had already mentioned I more or less relented, so I'm all for the a/v group method. My main concern is how to apply this. If someone has