Execution d'appel java dans script CGI pour webmin
Bonjour,
j'essaye désesperemment d'appeler un programme java dans un script perl/CGI utilisable dans webmin.
Voici l'appel java hors contexte :
Code:
java -cp /root/test_jmx/genericjmxclient.jar monclient.jmx.client.GenericClient service:jmx:rmi:///jndi/rmi://ipServeur:7700/management/rmi-jmx-connector getatb Appli:name=Deployment,type=service DeployedServiceAssemblies
Lorsque j'éxécute ce code en shell, il me répond correctement et me retourne ce qu'il doit me retourner.
En ajoutant >/dev/null il n'affiche rien. Normal :D
Maintenant voici mon script CGI :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!/usr/bin/perl
use strict;
use warnings;
use vars qw/%config %in/;
do '../web-lib.pl'; # fonctions fournies par webmin
use Config::General;
use Template;
use Data::Dumper;
# Init config
init_config();
# Ini args
ReadParse();
# Let's roll
header("ESB", "");
##### CONFIG ######
my %esb = {};
##### CONFIG END ###
$esb{'toto'} = `ls -l`;
print $esb{'toto'};
$esb{'toto2'}=`java -cp /root/test_jmx/genericjmxclient.jar monclient.jmx.client.GenericClient service:jmx:rmi:///jndi/rmi://ipServeur:7700/management/rmi-jmx-connector getatb Appli:name=Deployment,type=service DeployedServiceAssemblies`;
print $esb{'toto2'};
my $template= Template->new({
INCLUDE_PATH => '.', # or list ref
INTERPOLATE => 1, # expand "$var" in plain text
POST_CHOMP => 1, # cleanup whitespace
EVAL_PERL => 1, # evaluate Perl code blocks
});
# On affiche un label pour choisir l'hote
$template->process(
'html/main.html',
{
toto => $esb{'toto'},
toto2 => $esb{'toto2'},
}) || die $template->error();
footer("/", "l'accueil"); |
Le premier print sur 'toto' m'affiche bien le résultat du 'ls -l'.
Le second sur 'toto2' ne m'affiche rien car la variable est vide !!!!!!
J'ai essayé avec la fonction system : même bilan, variable vide
Je suis un peu perdu.
Y aurait-il quelque chose que je n'ai pas compris?:bug:
Merci d'avance pour votre précieuse aide