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...


All times are GMT. The time now is 14:46.

vBulletin® Version 3.8.8