Acpid Can't Run Screen Blank Script in FC4

Pete Toscano pete-fedora at verisignlabs.com
Fri Jul 1 21:14:28 UTC 2005


Mathieu Chouquet-Stringer wrote:

> It's pretty explicit, acpid runs as root and cannot access your display.

Indeed, this is true, but more importantly:

a) Why is it doing this?

b) What changed to make it not work in FC4 where it did work in FC3?

c) How do I get it to work?  :)

>>+ /usr/X11R6/bin/xset -display :0 dpms force standby
>>Xlib: connection to ":0.0" refused by server
>>Xlib: No protocol specified
>>
>>/usr/X11R6/bin/xset:  unable to open display ":0"
> 
> The same thing would happen if you try to run your script, as root, at the
> console (not X) while logged in under X.

You are correct.  This is exactly what happens.

Here's the script (ignore the wrapped "AUTH=" lines):

#!/bin/bash -x
PID=`pidof /usr/X11R6/bin/X`
if [ "$?" == "1" ]; then
  # not using X
  /usr/local/bin/radeontool light | grep "looks on" > /dev/null
  if [ "$?" == "0" ]; then
   /usr/local/bin/radeontool light off
  else
   /usr/local/bin/radeontool light on
  fi
else
  # using X
  AUTH=`perl -ne'/\x00-auth\x00(.*?)\x00.*/&&print$1' /proc/$PID/cmdline`
  if [ x"$AUTH" = x ]; then
      AUTH=`perl -ne'/(^|\x00)XAUTHORITY=(.*?)\x00/&&print$2'
/proc/$PID/environ`
  fi
  export XAUTHORITY=$AUTH
  /usr/X11R6/bin/xset -display :0 dpms force standby
fi





More information about the fedora-list mailing list