Shweta B. Patil
Shweta B. Patil

Reputation: 1169

ssh -ing and compiling the java program

Hello I need to ssh in one ip address and run my java code through shell script I do it by this way

ssh $LINE java -Djava.library.path=/N/u/sbpatil/ds/Project4/demons/Project4Lib -cp "/N/u/sbpatil/ds/Project4/demons:/N/u/sbpatil/ds/Project4/demons/Project4Lib/jug-uuid.jar:/N/u/sbpatil/ds/Project4/demons/Project4Lib/NaradaBrokering.jar:/N/u/sbpatil/ds/Project4/demons/Project4Lib/sigar.jar" PublisherClient >> output2 & 

but output2 file has no output whatsoever.Even if the run command of java is giving me an error,that error should be written in that file.,buts it is not being written. Can anybody please tell me how should i write this script?

Upvotes: 0

Views: 360

Answers (1)

Andrey Nudko
Andrey Nudko

Reputation: 707

Now it looks like you run ssh in the background, redirecting output into local file. Enclose the command line into '': ssh $LINE 'java ... 1>>output2 2>&1 &'

Also using nohup might be a good idea if you launch your app like that.

Upvotes: 2

Related Questions