maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   Need help with this command (https://talk.maemo.org/showthread.php?t=61693)

maxximuscool 2010-09-04 14:47

Re: Need help with this command
 
#!/usr/bin/python

import gtk
import gobject
import hildondesktop
import os
import sys
import stat

class Swappiness(hildondesktop.StatusMenuItem):
def __init__(self):

hildondesktop.StatusMenuItem.__init__(self)

#os.system('echo /usr/lib/hildon-desktop/Swappiness.py | root')
os.system('sudo chmod +x /usr/lib/hildon-desktop/Swappiness.py')

os.system('echo 30> /proc/sys/vm/swappiness')
#os.system('sudo chmod -R echo 30 > /proc/sys/vm/swappiness')
#swap_file = open('/proc/sys/vm/swappiness', 'w').write('30')
icon_theme = gtk.icon_theme_get_default()
pixbuf = icon_theme.load_icon("Swappiness", 22, gtk.ICON_LOOKUP_NO_SVG)
# hide icon after 1 sec
#gobject.timeout_add(1000, self.set_status_area_icon, None)
self.set_status_area_icon(pixbuf)

#label = gtk.Label("Show Me")
#self.add(label)
#self.show_all()



hd_plugin_type = Swappiness

This is my little simple script but nothing worked since I can't gain root access from the command os.system

maxximuscool 2010-09-04 15:48

Re: Need help with this command
 
I want to make this work at reboot. And also place an Icon as well.

RobbieThe1st 2010-09-05 04:21

Re: Need help with this command
 
As said before, you can't gain root access inside the script. The script has to be run as root!

maxximuscool 2010-09-05 08:11

Re: Need help with this command
 
Quote:

Originally Posted by RobbieThe1st (Post 807584)
As said before, you can't gain root access inside the script. The script has to be run as root!

Show me how to do that? from shell batch or something automatically without going through the xterminal and run it manually


All times are GMT. The time now is 22:16.

vBulletin® Version 3.8.8