Debugging script

This commit is contained in:
mickael
2019-02-08 10:20:18 +01:00
parent 4d9b29bbbd
commit 0072f8fd46
3 changed files with 28 additions and 18 deletions

View File

@@ -1,11 +1,18 @@
#!/bin/bash
PASS=""
#PASSWD
echo -n "password : "
read -s $PASS
if [ "$PASS" = "" ]
then
echo -n "password : "
read -s input
echo ""
PASS=$input
sed -e 's/^#PASSWD/PASS="'$PASS'"/g' agent.sh > agent.tmp.sh
fi
id=$1
log_f="log.tmp"
center="mickael@172.16.131.74"
@@ -24,10 +31,13 @@ sshpass -p $PASS ssh-copy-id -o StrictHostKeyChecking=no $host 2> /dev/null;
sshpass -p $PASS ssh-copy-id -o StrictHostKeyChecking=no $center 2> /dev/null;
scp -o StrictHostKeyChecking=no $host:config $remote:config;
scp -o StrictHostKeyChecking=no $host:agent.sh $remote:agent.sh;
scp -o StrictHostKeyChecking=no $host:agent.tmp.sh $remote:agent.tmp.sh;
scp -o StrictHostKeyChecking=no $host:analyze.sh $remote:analyze.sh;
./analyze.sh;
scp -o StrictHostKeyChecking=no log $center:log/log-$remote;
rm log;
./agent.sh $id;"
chmod u+x agent.tmp.sh;
chmod u+x analyze.sh;
./analyze.sh $log_f;
scp -o StrictHostKeyChecking=no $log_f $center:log/log-$remote;
rm $log_f;
./agent.tmp.sh $id;"
fi

View File

@@ -1,15 +1,15 @@
#!/bin/bash
# Indique au système que l'argument qui suit est le programme utilisé pour exécuter ce fichier
# En règle générale, les "#" servent à mettre en commentaire le texte qui suit comme ici
touch log
echo PROCESS > log
ps >> log
echo TACHE >> log
echo PERIPHERIQUE >> log
lsusb >> log
lspci >> log
echo MODELE >> log
cat /proc/version >> log
file=$1
echo PROCESS > $file
ps >> $file
echo TACHE >> $file
echo PERIPHERIQUE >> $file
lsusb >> $file
lspci >> $file
echo MODELE >> $file
cat /proc/version >> $file
echo COPIE LOG

View File

@@ -1,2 +1,2 @@
mickael@172.16.131.33
mickael@172.16.131.32
mickael@172.16.131.74