LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
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).

Notices

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

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


Hi,

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:
Code:
#!/bin/bash

case $3 in
    [..]
    00000063)
        /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
    ;;
    [..]
esac
After I press the key combination, /etc/acpi/test.txt contains:
Code:
Test World!
TOGGLE?
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?

Marek

Last edited by marco1475; 05-26-2009 at 05:30 PM. Reason: solved
 
Old 05-13-2009, 11:28 AM   #2
*******
Member
 
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, 05:29 PM   #3
marco1475
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!

[0] http://marek.vojtko.com/linuxwiki/do...s:screentoggle
 
  


Reply

Tags
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 05:21 AM
Executing scripts jonette20 Linux - General 3 10-15-2007 02:50 PM
executing Bash Scripts c4nk Linux - General 3 03-11-2007 05:52 PM
CGI Scripts not executing Mr_Oz Linux - Enterprise 7 04-18-2006 04:21 PM
Executing Shell Scripts? l0f33t Linux - General 7 08-17-2003 04:36 PM


All times are GMT -5. The time now is 09:20 PM.

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