Execute Perl script from Java tomcat returns ever 255 exit code -


i have problem, i'm trying execute perl script allocated on server. if execute command in linux shell, script run correctly. if execute script allocating perl script in same server of apache tomcat, runs ok, when try execute script through ssh tomcat, end error code 255.

perl script:

#!/usr/bin/perl $sleeptime = 10; sleep($sleeptime);  $argumento=$argv[0]; if ( $argumento eq "a" ) {     exit 0; } else {     exit 192; } 

now, code in java file

string command = "ssh root@myserver.com '/usr/bin/perl /var/www/testperl.pl a'"; process = runtime.getruntime().exec(command); process.waitfor();   if ( process.exitvalue() == 0 ) {     system.out.println("show icon ok"); } else {     system.out.println("show error"); } 

if change command variable to

string command = "/usr/bin/perl /var/www/testperl.pl a"; 

the return code ok ( 0 or 192 )

is mandatory execute remotely, can't copy real perl tomcat directory. did localy test.

did try ssh call tomcat server tomcat user, e.g.

ssh root@myserver.com '/usr/bin/perl /var/www/testperl.pl a' 

try adding -v ssh argument , capture output see if ssh connection working. maybe you're missing rsaauthentication (key-based instead of password-based) or else doesn't work should.

try returning value perl debugging:

print "i'm running (stdout)\n"; print stderr "i'm running (stderr)\n"; 

Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -