Davide
Davide

Reputation: 2124

'Watch' command doesn't work in bash script called by Ganymed library in Java

I've a script. It looks like this:

#!/bin/sh
watch -n300 java -jar myapp.jar > out.log &
mkdir aaa
echo "App accesa"

When I call this myscript.sh from my app in Java with the Ganymed library it doesn't execute the watch statement but the 'aaa' folder has been created. My statement in java is

Session sess = conn.openSession();
String command = "cd /root/;./myscript.sh";            
System.out.println(command);
sess.execCommand(command);

I can't understand the problem why if I run the myscript.sh script from console it works fine.

Thanks in advance

Upvotes: 0

Views: 352

Answers (0)

Related Questions