how to run program after program?

Hi there everyone. I’ve installed an utility for monitoring web traffic ,called WebScarab. I’ve set in firefox to use it as proxy server and now I have to start WebScarab before I can start the browser, which is ok, but now I would like to make a shortcut on my desktop, which would first start WebScarab and then firefox, to automate the process. I tried entering the command of the shortcut like this

java -jar "/home/arcull/WebScarab/webscarab.jar" && firefox %u

but it doesn’t work, browser doesn’t start. Please help, thanks in advance.

Oh I think you’re problem is that it’s not running the commands asynchroniously, so it is waiting for the first one to finish. I guess I’m not too sure how to do it in one command, you probably need an & somewhere though and I don’t know how to fit it in one command.

Have you tried launching from a bash script? That’s generally my go to solution for launchers, I find they’re pretty simple and flexible (i.e. if you need to set environmental variables, or the starting directory, etc. you can). here maybe:


#!/bin/bash

java -jar "/home/arcull/WebScarab/webscarab.jar" &
firefox

Actually I don’t know what the %u in the command you gave does, so I don’t know where it would go. Here the & is what makes the first one run as a different process.

Then you save it as FILENAME, and for the command in the launch you either use:

sh FILENAME

or else you first use

chmod +x FILENAME

from the command line and use as a launch command just

FILENAME

Hope that helps, there is almost certainly a way to get it into one command also I just don’t know what it is.

Malcolm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The ‘&&’ doesn’t work the way you expect it to. Try replacing the ‘&&’
with just ‘&’ and I think it will be a little better for you.

Good luck.

On 09/11/2010 07:06 AM, arcull wrote:
>
> Hi there everyone. I’ve installed an utility for monitoring web traffic
> ,called WebScarab. I’ve set in firefox to use it as proxy server and now
> I have to start WebScarab before I can start the browser, which is ok,
> but now I would like to make a shortcut on my desktop, which would first
> start WebScarab and then firefox, to automate the process. I tried
> entering the command of the shortcut like this
> Code:
> --------------------
> java -jar “/home/arcull/WebScarab/webscarab.jar” && firefox %u
> --------------------
> but it doesn’t work, browser doesn’t start. Please help, thanks in
> advance.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJMi4orAAoJEF+XTK08PnB5wnYQAKlcFh8q7Vq2wEc6kMJflJT7
kIoVzXwdBVcq99BZ1NVOrcCNjNwAG8Fdb6THkEeZqAKXQT1CanvNlH80+E6PUaGp
fvI39sqhh3VTfsP0L0PLRfuJlwJk/15GK58NNJjDm+YBcVnuBISDscVKAXfqXrwS
Mfp9JlvnH6BH1qjumgH9pmkTo4GJQCEeGfJfK5ldHp0cvsNDhz3eZsf6Eae0GEA/
y7sUNgtJo87y8XsQ94T/x0soykYqzn+zk+m69xLS9rwEyzN/aIztxFM3FI3EDBu8
6WDwGY8TFh6GVDEWKlV3IG0yqblcehftpPhbzFXXwJxY52SZa69UlwtvlJpEq+Nj
Zo2U/FUzmwbl8XH7WzvDZ2Ss0BDZJK39cpj2DCCr6GNWAg8BQBXi+KnfWbisGP93
roFnHlKMY4caVe6AjfBxF3i4UBApzZYdLAT4RElHI7gahvLSl1ZjZiqIEM5spnXB
bSoNoJi2bVX0w85wCqfNEICpN8TacUSH8se6LBprrT24WIvkUp0l69YQPcR1VGsV
YmFUoZ/lsOcZcWOnqN+N0EtW8GwiYWGrGuKowlRWeI+rOC49KgNRftv7J+EAGYpV
707gE2rLEyzyX87bZsVxkP33u85iogwhVMzrysiDQeuhdj4c/eXG/23A+ZURuidU
n8IuFwP48O2xBDht98ZM
=MNVW
-----END PGP SIGNATURE-----

i tried writing a script with

#!/bin/bash

java -jar "/home/arcull/WebScarab/webscarab.jar" &
firefox

as malcolm81 suggested, and then run the script on the shortcut. The results are better, but still not perfect. The problem seems, that starting up WebScarab takes more time than starting up firefox, therefore firefox shows up first, saying it can not connect to proxy. So I guess I should include a few seconds of delay between both commands. So I tried like this

#!/bin/bash
java -jar "/home/arcull/WebScarab/webscarab.jar" &
sleep 5 &
firefox

but still no go :frowning: Additional help appreciated :slight_smile:

try


#!/bin/bash
java -jar "/home/arcull/WebScarab/webscarab.jar" &
sleep 5
firefox

without the & after sleep. You want those run in succession, not asynchroniously (they are both starting at the same time in the original.)

Malcolm

malcolm81

try

Code:

#!/bin/bash
java -jar "/home/arcull/WebScarab/webscarab.jar" &
sleep 5
firefox

without the & after sleep. You want those run in succession, not asynchroniously (they are both starting at the same time in the original.)

Malcolm 

Works ok, thanks :slight_smile: Is there any switch available to run an app minimized? In my case, I would prefer webscarab starting minimized. Thanks again.

That depends on the windowmanager you use. In case of KWin / KDE it would be

kstart --iconify $command

gropiuskalle

That depends on the windowmanager you use. In case of KWin / KDE it would be

Code:

kstart --iconify $command

I don’t know which windowmanager I have :frowning: I have suse 11.2 with gnome. If I try to run

kstart --iconify nautilus

it runs nautilus but not minimized. Need more help :frowning:

I am not sure there’s a likewise command for GNOME / Metacity, but there’s a tool called →Devil’s Pie which obviously lets you manage it in a convenient way, so give it a shot.

Have a look at

man xinetd

and use xinetd to start webscarab whenever it is needed.


login: root
*********
Welcome to openSUSE 11.3
init 1 &&init 3 && init 5 && init 0

Works for me… :slight_smile:

I’ll give it a try thanks