Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shell scripting, run in parallel processes

Tags:

bash

shell

#!/bin/ksh
##########################################################################
$JAVA_HOME/bin/java -jar SocketListener.jar 8182

run_something_else

exit 0

SocketListener is started, and shell is waiting while SocketListener don't die.

How can I run run_something_else and SocketListener at the same time

like image 568
Ilya Avatar asked Jun 28 '26 10:06

Ilya


2 Answers

$JAVA_HOME/bin/java -jar SocketListener.jar 8182 &

add an ampersand(&) at the end.this will give control of the terminal to the next line and makes your SocketListener run in the background.

like image 86
Vijay Avatar answered Jun 30 '26 02:06

Vijay


nohup can be used to run the process in the background as daemon.

nohup runsomethingelse &
like image 26
Balaswamy Vaddeman Avatar answered Jun 30 '26 02:06

Balaswamy Vaddeman