PDA

View Full Version : 'irexec -d' does not start automatically in Gnome after upgarading to Fedora 18



AMTom
27th January 2013, 08:45 AM
Hello!
Previously in Fedora 17 my lirc services started without any problem, i.e. my rc.local file included the following line:
'mkdir /var/run/lirc/ && /usr/local/sbin/lircd -H dev/input -d /dev/input/event7'

and file /usr/share/gnome/autostart/lirc-irexec.desktop was created containing the following:
[Desktop Entry]
Type=Application
Name=IREXEC
Comment=Starts IREXEC whenever you log in
Exec=/usr/local/bin/irexec -d

So that I could manage my TV software by remote control immediately after Gnome session had started.

After upgrading to Fedora 18 in order to start 'lircd -H dev/input -d /dev/input/event7' I had to modify selinux by
# grep lircd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

And lircd service stated working but irexec cannot autostart in Gnome, it works only if manually started in console:

$ /usr/local/bin/irexec -d

If somebody knows how to start irexec automatically in Gnome in Fedora 18, please let me know.

Thank you in advance.
Best regards,
Tom

dwg456
30th December 2013, 02:55 PM
I just had the same problem and figured it out.

In my F18 system, lircd had not yet been started by systemd, so irexec was terminating because it could not open the socket.

Solution I found was to create a small start script :

while [ ! -s /run/lirc/lircd.pid ]; do sleep 2;done
/usr/bin/irexec -d


The script will check every 2 seconds and start irexec after lircd is running.

jpollard
30th December 2013, 02:59 PM
Ouch.

Should a "after=" have worked?

DBelton
30th December 2013, 03:26 PM
You should be able to start lirc with systemd instead of having to use a script in rc.local




systemctl enable lircd


And to start irexec, you could write your own systemd service file to start it.

I would start with something like this, and modify as necessary:



[Unit]
Description=LIRC Infrared Signal Decoder - irexec
Requires=lirc.service
After=network.target lirc.service

[Service]
Type=simple
ExecStart=/usr/bin/irexec /etc/lirc/irexec.conf

[Install]
WantedBy=multi-user.target

dwg456
3rd January 2014, 12:00 AM
I considered running irexec as a systemd service.

"irexec" is a program that allows a user to configure buttons on an infrared remote control to start various programs. What if you have different users on the system, and you want to give different config files to irexec depending on which user logs in, so that each user can customize the buttons?

I haven't tested it, but if running as a systemd service you would probably need to configure it to run as a specific user so that all programs started by irexec will be under that User's UID, and I am not sure how to get it to switch to different config files.

Starting it from the GNOME session is probably better, but the "wait for lirc" could be more elegant. In my current case the GNOME session starts soon after boot because "autologin" is set. I suppose I could make the GNOME session dependent on the lirc service...not really something I would advise.

Is there some more elegant way to allow a user bash script determine if a service is running?

Checking for a PID file works in this case, but I would think that some services don't create PID files. I suppose I can also check the exit code of "systemctl status lirc" in this case.