maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   killall = no process killed ? (https://talk.maemo.org/showthread.php?t=57289)

leetut 2010-06-27 19:42

killall = no process killed ?
 
looking for some help with this,
i have a desktop file that i need to copy a file, and then kill a process,
looks like this so far:

Exec=osso-xterm 'sudo cp -r /home/user/MyDocs/rtcom-messaging-ui.launch /usr/bin/'
Exec=osso-xterm 'sudo killall rtcom-messaging-ui'

but the second part is not doing anything

also tried it in one single command like this:

Exec=osso-xterm 'sudo cp -r /home/user/MyDocs/rtcom-messaging-ui.launch /usr/bin/ killall rtcom-messaging-ui'

but still the killall part does nothing
both commands work if i enter them seperately in xterm,
but again, i need all this in a desktop file so i can run it with the click of a button,
can any of you clever souls help!:confused:

Joorin 2010-06-27 19:45

Re: killall = no process killed ?
 
&& is used to concatenate shell commands. Put that between the commands. You can also use ; as concatenation but then the result of the first command won't affect the second (as far as I know, look in the documentation for the busybox).

EDIT:
And to understand why the second of your versions won't work, have a look at what you've actually written. You're trying to copy unwanted things to unwanted places. This might very well end up doing bad things with the system.

leetut 2010-06-27 19:51

Re: killall = no process killed ?
 
Exec=osso-xterm 'sudo cp -r /home/user/MyDocs/rtcom-messaging-ui.launch /usr/bin/ && killall rtcom-messaging-ui'

copys the file, but still not killing the process:(

leetut 2010-06-27 19:54

Re: killall = no process killed ?
 
theres method in the madness bro!
i deliberately want to do bad things to MY system!
i know exactly what im copying from and to
its for a good reason
just need help to get it to work like it does using xterm
thing is after copying 'my' file to usr/bin the old one is still running
this is why i need to kill that process, for mine to be started

leetut 2010-06-27 20:10

Re: killall = no process killed ?
 
just noticed that if i have && in my command,
killall rtcom-messaging-ui
no longer works in xterm either

leetut 2010-06-27 20:46

Re: killall = no process killed ?
 
still getting nowhere with this:(

Joorin 2010-06-27 21:02

Re: killall = no process killed ?
 
Code:

sudo cp -r /home/user/MyDocs/rtcom-messaging-ui.launch
Recursive copy of argument 1

/usr/bin/
argument 2

killall
argument 3

rtcom-messaging-ui
to destination

Do you really want to recursively copy /usr/bin to rtcom-messaging.ui? Just asking... :)

If I try
Code:

ls && ls

or

ls ; ls

on my system I get the expected result. Both work just fine in an XTerminal on the N900 too. Perhaps the parser that looks at the exec line is picky and discards the second half of your command?

How do you know that the killall command hasn't been run? Did you try with a ";" too?

willi_iam 2010-06-27 21:11

Re: killall = no process killed ?
 
I experienced, that the combination of two commands with ';' or '&&' wasn't working within ' .desktop'-files. (at leat the way i tried)

So i putted the commands into a shell-script and executed the script via the .desktop-link...

That solved the problem... at least for me ;)

leetut 2010-06-27 22:02

Re: killall = no process killed ?
 
i tried both && and ;
i know killall wasnt run because messaging still works
it should fail to work and say internal error messaging closed, like it does if i use xterm running seperate commands

the shell script idea looks promising, but im a total linux n00b here!
im actually surprised i got this far!
how do i make a shell script and execute it in a desktop file?

willi_iam 2010-06-27 22:28

Re: killall = no process killed ?
 
oA simple script could look like this:

Code:

#!/bin/sh
command1
command2

or in your case (if the commands are correct an you know what you're doing ;) ):
Code:

#!/bin/sh
cp -r /home/user/MyDocs/rtcom-messaging-ui.launch /usr/bin/ && killall rtcom-messaging-ui

just use a text editor and save the file e.g. in /home/user/bin (thats where i save my scripts) or any directory you want...
Then you have to make it executable:
Code:

chmod u+x /home/user/bin/$filename
in xterm, where '/home/user/bin' is the path where the file is saved and ''$filename" is the name you choosed.

Then the exec-line in .desktop-file should look like this:
Code:

Exec=osso-xterm -e "sudo /home/user/bin/$filename"
so the script is executed as 'root'

In advance you can check if the script is working via:
Code:

/home/user/bin/$filename
in xterm...

leetut 2010-06-27 22:41

Re: killall = no process killed ?
 
chmod u+x /home/user/bin/smsmodscript
gives me: no such file or directory?

tried removing .txt from the file and from the command

my txt file is called smsmodscript.txt

i dont have a /home/user/bin/ folder
only have a /usr/bin folder

using WinSCP

http://img443.imageshack.us/img443/355/82578614.png

willi_iam 2010-06-27 22:49

Re: killall = no process killed ?
 
It doesn't matter where you save the file, but I don't like saving it to /usr/bin because it's a system folder (and would get lost with a reflash ;) ).

You can save it to /home/user also, or you create /home/user/bin with:
Code:

mkdir /home/user/bin
for the chmod-command you have to change into the directory where the file is located and type:
'chmod u+x smsmodscript'
or, if you're in an other directory:
'chmod u+x /your/path/to/smsmodscript'

where 'smsmodscript' is the filename you've choosen for the script and which it was saved to...

leetut 2010-06-27 22:56

Re: killall = no process killed ?
 
ive put the file smsmodscript.txt into home/user

and typed chmod u+x smsmodscript
and
chmod u+x /home/user/smsmodscript

but still get no such file or directory

willi_iam 2010-06-27 23:01

Re: killall = no process killed ?
 
you have to use the correct filename...

Either you rename the file to 'smsmodscript' (without .txt) or you have to add the .txt to chmod-command

I'd prefer renaming, because .txt is misleading ;)

leetut 2010-06-27 23:11

Re: killall = no process killed (solved!)
 
id just figured that out bro, when it started working!
awesome info all that, i knew it was going to work when i started reading it,
as always it was just a case of my brain understanding it!
anyway, what i did was make 2 buttons, one to crash the messaging app, and one to make it work again, kind of a a lock and unlock feature:

http://img441.imageshack.us/img441/2...0062722270.png

willi_iam 2010-06-27 23:20

Re: killall = no process killed ?
 
Hey... I'm glad if i could help you...

Now go on and script the hell out of your pocket-plaything :P

leetut 2010-06-27 23:33

Re: killall = no process killed ?
 
yeah man, both you and Joorin helped me understand a lot in this thread, but your info got my little mod working!
now my woman cant look at my texts when im not around!
happy days!

Joorin 2010-06-28 19:22

Re: killall = no process killed ?
 
Quote:

Originally Posted by leetut (Post 732022)
now my woman cant look at my texts when im not around!
happy days!

That's the lowest level of hack there is. ;)


All times are GMT. The time now is 11:09.

vBulletin® Version 3.8.8