LinHES Forums
http://forums.linhes.org/

part of script runs, but not all!
http://forums.linhes.org/viewtopic.php?f=17&t=19313
Page 1 of 1

Author:  jzigmyth [ Sun Nov 30, 2008 9:49 am ]
Post subject:  part of script runs, but not all!

I am trying to run a script from a button on the remote in R5.5. The script should copy a new xorg.conf over the old one and then restart X. I have assigned the script to Alt0 in /etc/X11/fluxbox/keys with:
Code:
Mod1 0 :ExecCommand sudo /home/mythtv/zig/xorgOrig.sh

Here is the script:/home/mythtv/zig/xorgOrig.sh
Code:
#!/bin/bash
cp /etc/X11/xorg.conf.lastworkinggoodmulti /etc/X11/xorg.conf
pkill xinit

The script runs fine when I press Alt0 on the keyboard. I want to run it from the remote as well so I put the script path in "sudoers" and have this in /home/mythtv/.mythtv/lircrc
Code:
begin
    prog = irexec
    button = s0
    # script to restart X with original multi monitor xorg.conf
    config = /home/mythtv/zig/xorgOrig.sh
    # config = /home/mythtv/zig/xorgOrig.sh &
end
The problem is that when I press s0 on the remote the "cp" command is ignored but "pkill xinit" is executed. Why would one line be run and another line ignored? Especially when the script works ok from the keyboard?

(also not sure what the & does, but I saw it in an example and tried it with and without to no avail)

Author:  brfransen [ Sun Nov 30, 2008 11:05 am ]
Post subject: 

I believe it is failing because lirc is running as user mythtv and you forgot to put sudo in your config line of the lircrc file:
Code:
config = sudo /home/mythtv/zig/xorgOrig.sh


Britney

Author:  jzigmyth [ Sun Nov 30, 2008 12:24 pm ]
Post subject: 

Thanks, Britney! Worked like a charm! I thought that putting the script into "sudoers" took care of that. Now I"m wondering if it needs to be in "sudoers" at all?
Thanks again,
Ziggy

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/