Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).


  Search this Thread
Old 05-11-2009, 08:37 PM   #1
LQ Newbie
Registered: May 2009
Posts: 8

Rep: Reputation: 1
ACPI Script Not-Executing Other Scripts [SOLVED]


I have set up my ACPI to handle Fn+F* keys and the events get intercepted, i.e. ACPI works. I have a different shell script that is supposed to toggle between my notebook's internal and external screen - this script when run by itself from XTerm works as well. However, I cannot get it to execute properly in the ACPI script.

After a few tries I realized that none of the calls to xrandr or lspci from my script get executed. As a simple test, here is what I have so far:

case $3 in
        /usr/local/sbin/test >> /etc/acpi/test.txt    # the "test" script just says: echo "Test World!"
        echo "TOGGLE?" >> /etc/acpi/test.txt
        xrandr >> /etc/acpi/test.txt
After I press the key combination, /etc/acpi/test.txt contains:
Test World!
So ACPI works because it triggered on the correct code and just piping echo into a file and piping the output of my own custom script into a file worked. (Obviously, since the ACPI script is non-interactive I have to pipe echo into a file.) But trying to call anything remotely useful, like xrandr, lspci, etc. just does nothing! I tried full paths, "su root -c `<command>`" and "sh -c `<command>`" (which and without the `), but nothing seems to be working.

What am I doing wrong?


Last edited by marco1475; 05-26-2009 at 04:30 PM. Reason: solved
Old 05-13-2009, 10:28 AM   #2
Registered: Feb 2009
Posts: 63

Rep: Reputation: 16
No idea. Might be related to anything from ~/.Xauthority access, available $DISPLAY environment variable to not using full paths. If you set up Sudo and configure your user to run xrandr as root, what does "sudo /path/to/xrandr --prop 2>&1" return? Else what does acpi(d).log show? And please don't use backticks if you don't need them.
Old 05-26-2009, 04:29 PM   #3
LQ Newbie
Registered: May 2009
Posts: 8

Original Poster
Rep: Reputation: 1
Thanks for the reply - it was actually what you suspected: XAUTHORITY and DISPLAY variables.

After I piped the error messages into a text files as well (2>&1) I got the error message about missing XAUTHORITY and DISPLAY variables. With some work I was able to tell the script where to find both and now it's all working.

If anyone is interested in the whole process or more detailed solution, have a look at my Linux Wiki [0].

Thanks again!



acpi, bash, script, xrandr

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem executing scripts mierdatuti Linux - General 4 09-19-2008 04:21 AM
Executing scripts jonette20 Linux - General 3 10-15-2007 01:50 PM
executing Bash Scripts c4nk Linux - General 3 03-11-2007 04:52 PM
CGI Scripts not executing Mr_Oz Linux - Enterprise 7 04-18-2006 03:21 PM
Executing Shell Scripts? l0f33t Linux - General 7 08-17-2003 03:36 PM > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 03:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration