Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GNOME2 - Running script with root privileges at login.
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
divisionbyzero
n00b
n00b


Joined: 27 Apr 2010
Posts: 11

PostPosted: Sat Jul 09, 2011 5:07 pm    Post subject: GNOME2 - Running script with root privileges at login. Reply with quote

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
View user's profile Send private message
salahx
Guru
Guru


Joined: 12 Mar 2005
Posts: 530

PostPosted: Sun Jul 10, 2011 7:24 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
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