Active Topics

 


Reply
Thread Tools
leetut's Avatar
Posts: 1,169 | Thanked: 1,174 times | Joined on Jan 2010 @ sunderland
#1
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!
__________________
born to rage against them
 
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#2
&& 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.

Last edited by Joorin; 2010-06-27 at 19:48.
 

The Following User Says Thank You to Joorin For This Useful Post:
leetut's Avatar
Posts: 1,169 | Thanked: 1,174 times | Joined on Jan 2010 @ sunderland
#3
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
__________________
born to rage against them

Last edited by leetut; 2010-06-27 at 19:55.
 
leetut's Avatar
Posts: 1,169 | Thanked: 1,174 times | Joined on Jan 2010 @ sunderland
#4
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
__________________
born to rage against them

Last edited by leetut; 2010-06-27 at 19:58.
 
leetut's Avatar
Posts: 1,169 | Thanked: 1,174 times | Joined on Jan 2010 @ sunderland
#5
just noticed that if i have && in my command,
killall rtcom-messaging-ui
no longer works in xterm either
__________________
born to rage against them
 
leetut's Avatar
Posts: 1,169 | Thanked: 1,174 times | Joined on Jan 2010 @ sunderland
#6
still getting nowhere with this
__________________
born to rage against them
 
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#7
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?
 

The Following User Says Thank You to Joorin For This Useful Post:
willi_iam's Avatar
Posts: 27 | Thanked: 20 times | Joined on Jun 2010 @ Cologne
#8
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
 

The Following User Says Thank You to willi_iam For This Useful Post:
leetut's Avatar
Posts: 1,169 | Thanked: 1,174 times | Joined on Jan 2010 @ sunderland
#9
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?
__________________
born to rage against them
 
willi_iam's Avatar
Posts: 27 | Thanked: 20 times | Joined on Jun 2010 @ Cologne
#10
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...
__________________
Everything is a file and if it's not, it should be!
 

The Following User Says Thank You to willi_iam For This Useful Post:
Reply

Tags
killall


 
Forum Jump


All times are GMT. The time now is 10:28.