running process in backround using a bash script
Question
I want run a script as follows:
runner: ssh 'java program &' ssh 'java program &'
How do I write the script to fork the first process? Currently, it waits for it to finish.
thanks
Solution
Actually, I think you want
ssh -f -n remotesystem 'command&'
OTHER TIPS
In your script:
#!/bin/sh
ssh yourhost 'java program &' &
ssh yourhost 'java program &'
The first ssh will start a session running a java program in the background. If the java program is a graphical application and you are running with port forwarding enabled the ssh process will still continue running even after the command java program &
is finished. By adding the final &
to the first command line the ssh program will be put running in the background.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow