View previous topic :: View next topic |
Author |
Message |
divisionbyzero n00b
Joined: 27 Apr 2010 Posts: 11
|
Posted: Sat Jul 09, 2011 5:07 pm Post subject: GNOME2 - Running script with root privileges at login. |
|
|
Hey, I have created a python daemon (a basic power management program) and one of the things it does is write integers (0-10) to /sys/class/backlight/..../brightness... so as to change the screen brightness. This file is owned by the root and I cannot change that.
In the python daemon, I call the short script 'change_brightness.py' that handles writing these integers to the above brightness file. When I call this script I call it with the sudo command. [ Popen('sudo', 'python', 'change_brightness.py') - no password required by the way ]
This works perfectly, and once I'm logged in, I can call change_brightness.py and it will change the brightness accordingly.
However, when I run my daemon while logging in to Gnome (using startup applications), for some reason the change_brightness.py script is not called successfully with root privileges. The daemon starts up and keeps running in the background, but it's useless because it can't call any of its scripts successfully as root. |
|
Back to top |
|
|
salahx Guru
Joined: 12 Mar 2005 Posts: 530
|
Posted: Sun Jul 10, 2011 7:24 am Post subject: |
|
|
Brightness can be controlled via xrandr, so you shouldn't need the daemon.
Otherwise, if that won't work, you could solve this the way many applications have: Rewrite your daemon a D-Bus service. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|