This is strange! This is the perl script which controls the back light and screensaver depending on the lid switch position.
# Manage the backlight. Even if we're not going to sleep, it makes sense. if ($will_sleep==0 && $device eq "LID") {
if ($lid_state eq "open") { # reopening. backlight "on"; system "su -c '/etc/acpi/actions/perl_dcop.pl false' birtj"; print DEBUG "It's off\n"; } elsif ($lid_state eq "closed") { #closing. backlight "off"; #system "dcop kdesktop KScreensaverIface enable false"; } }
This works fine if I call it manully from a root console. If it's called from via the acpi lid switch event the backlight is turned of but the screen saver is not turned off. I assume this is some wierd permissions related problem. Something like a script called by the 'system' can't call a script as a diffrent user?
I'm lost any ideas?
Thanks,
Jeff_Birt
-----Original Message----- From: fedora-list-bounces@redhat.com on behalf of Matthew Miller Sent: Sat 4/30/2005 11:58 PM To: For users of Fedora Core releases Subject: Re: what 'user' are acpi scripts run as? Forcing DCOP to look atcurrent user?
On Sat, Apr 30, 2005 at 11:54:23PM -0500, Birt, Jeffrey wrote:
I am assuming that the acpi scripts are run as 'system' (or what ever the Linux equivelent is) and therefore any DCOP related calls are looking at the 'systems' DCOP server not the current user.
I believe they're executed as root.
So, can I force a script to run as another user? that is have the acpi script which is being run as 'system' call another script as the current user?
Yes -- use 'su -c' to do this.
On Sun, May 01, 2005 at 09:38:19PM -0500, Birt, Jeffrey wrote:
system "su -c '/etc/acpi/actions/perl_dcop.pl false' birtj";
I presume you meant
system "su birtj -c '/etc/acpi/actions/perl_dcop.pl false'";