maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   help with making a script (https://talk.maemo.org/showthread.php?t=46518)

felbutss 2010-03-04 20:57

help with making a script
 
hey guys i did a search before posting but havent been able to find anything.

well i have this bug https://bugs.maemo.org/show_bug.cgi?id=8723
every day i have to run the following command in xterminal to stop my n900 from not responding

sudo gainroot
killall hildon-desktop
killall hildon-home

im wondering how i can make it into a simple script and have a shortcut on the desktop?????

sorry. any help would be good im still learning and love it :)

daperl 2010-03-04 21:48

Re: help with making a script
 
Whoa, that sucks.

Yes, I should be able to help, but you caught me at the worst possible time. If no one helps you within the next 24 hours I should be able to cook something up for you by then. In the meantime, here's a link that show an exec of a command line call and here's a very simple example of a desktop (home) applet. You need to add a widget that will signal your command line calls. Also, you probably need to open up your /etc/sudoers to allow "user" some more power.

Good luck!

felbutss 2010-03-04 22:59

Re: help with making a script
 
hey. im still a little confused. im a pro with microsoft but still learning linux


i need something like a bat/shell file. i want to be able to install it then add a shortcut to the desktop.

can someone make it for me please? i also want to see how you did it and what i do next. still learning


any help??

felbutss 2010-03-05 01:48

Re: help with making a script
 
anyone? is it that hard? :S

daperl 2010-03-05 17:30

Re: help with making a script
 
Copy and paste the following into a file called:

/home/user/killerapp.sh

Code:

#! /bin/sh

/usr/bin/sudo /usr/sbin/gainroot
/usr/bin/killall hildon-desktop
/usr/bin/killall hildon-home

Then, from a terminal, run the command:

Code:

chmod 777 /home/user/killerapp.sh
As root, copy and paste the following into a file called:

/usr/share/applications/hildon/killerapp.desktop

Code:

[Desktop Entry]
Type=Application
Name=App Killer
Exec=/usr/bin/osso-xterm /home/user/killerapp.sh

Now, got to the application manager. Be patient while it quickly updates itself. Then, go to the last page and verify that "App Killer" exists.

Add "App Killer" as a desktop shortcut.

Matan 2010-03-05 18:04

Re: help with making a script
 
It does not work like this. The killall commands after the sudo command will not run as root.

But it should not be a problem, since hildon-home and hildon-desktop run as user, so there should not be a problem to run those commands as user as well.

daperl 2010-03-05 18:59

Re: help with making a script
 
Quote:

Originally Posted by Matan (Post 557118)
It does not work like this. The killall commands after the sudo command will not run as root.

But it should not be a problem, since hildon-home and hildon-desktop run as user, so there should not be a problem to run those commands as user as well.

Are you saying that

Code:

#! /bin/sh

/usr/bin/killall hildon-desktop
/usr/bin/killall hildon-home

would do what he wants it to do?

EDIT: Changed it in the above script.

Also, if he's not root, would he need a -9?

felbutss 2010-03-06 00:51

Re: help with making a script
 
thanks so much guys. ill have a play with it tonight :D. i want to try a few things with scripts. how do i run scripts as root though?

daperl 2010-03-06 02:51

Re: help with making a script
 
Quote:

Originally Posted by felbutss (Post 557461)
thanks so much guys. ill have a play with it tonight :D. i want to try a few things with scripts. how do i run scripts as root though?

I'm not sure if this is the best advice, but if, as root, you add the following line to

/etc/sudoers

Code:

user ALL = NOPASSWD: ALL
you should be able to run anything as root by putting

sudo

in front of it. For instance,

Code:

sudo whoami
should output "root" and not "user."

felbutss 2010-03-06 17:07

Re: help with making a script
 
quick question. how do i set a icon??? sorry to break balls


All times are GMT. The time now is 00:47.

vBulletin® Version 3.8.8