Bonjour à tous,

Je viens vers vous pour solliciter votre aide concernant ce module car je n'arrive pas à exécuter plusieurs commandes bash de suite grace à ce module.

Pourriez vous jeter un œil ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
#!/usr/bin/perl
use strict;
use warnings;

use Net::SSH::Expect;
 
my $host = "distant_host";
my $user = "user_name";
 
my $ssh = Net::SSH::Expect->new (
            host => $host, 
            user => $user, 
            raw_pty => 1
        );
 
$ssh->run_ssh() or die "SSH process couldn't start: $!";
my $cd = $ssh->exec("cd scripts/workspace/");
my $cp = $ssh->exec("nohup ./bash_cp_lib.sh > out_bash_cp_lib.txt"); # mv (SCP) the librairy files
my $blastclust = $ssh->exec("nohup ./bash_blastclust.sh > out_bash_blastclust.txt");# clusterise


#my $count_lib = $ssh->exec("ls -l /scripts/data/lib/original/*.fa | wc -l");
#my $cnt_lib_95 = $ssh->exec("ls -l /scripts/data/lib/lib_95/*.fa | wc -l");
#die "problem during blastclust" if ($count_lib!=$cnt_lib_95);


#my $ls = $ssh->exec("nohup ./bash_master.sh > out_bash_master.txt");# generate PNG

$ssh->close();

Lorsque j'essaye de lancer les trois commandes suivantes :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
my $cd = $ssh->exec("cd scripts/workspace/");
my $cp = $ssh->exec("nohup ./bash_cp_lib.sh > out_bash_cp_lib.txt"); # mv (SCP) the librairy files
my $blastclust = $ssh->exec("nohup ./bash_blastclust.sh > out_bash_blastclust.txt");# clusterise
uniquement les commandes $cd && $cp fonctionnent

et lorsque je commente $cp, la commande $blastclust fonctionne correctement.
Les scripts sont donc correctes mais l'exécution de commande exec à plusieurs reprises ne se fait pas.

Faut il créer plusieurs objets $ssh ?

Merci d'avance pour votre aide !