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 49 50 51 52 53
| #!/bin/sh
SIM_TAB=( 'Dossier_test' )
DESTINATION='user@IP:'
DESTINATION_ERROR=0
# ==========BOUCLE===========
SIM_NUM=${#SIM_TAB[*]}
for((i=0;i<=($SIM_NUM - 1);i++))
do
SIM_NAME=${SIM_TAB[$i]}
# 17 =========TRANSFERT========
expect - <<ENDSCRIPT
set timeout -1
spawn scp -r $SIM_NAME $DESTINATION
expect {
"*password:*"
{
send "MDP\r"
exp_continue
}
}
catch wait REASON
exit $REASON
ENDSCRIPT
#echo $? > jo_file
#STATUS=$?
#echo $STATUS > jo_file
#if [ STATUS == 0 ];
# then
# rm -r $SIM_NAME
# else
# cp -r $SIM_NAME /space/jbrulatout/Simulation_Recuperation/
# DESTINATION_ERROR=1
# rm -r $SIM_NAME
#fi
#if [ $DESTINATION_ERROR == 1 ];
# then
# echo "Simulation transfered on Zephyre" | mail -s " $SIM_NAME ended " blalba@blalba.fr
# else
# echo "Simulation ended" | mail -s " $SIM_NAME ended " blalba@blalba.fr
#fi
done |
Partager