Adding a launcher

This commit is contained in:
mickael
2019-02-08 11:02:18 +01:00
parent 0072f8fd46
commit 8f82245f38
4 changed files with 25 additions and 8 deletions

View File

@@ -1,6 +1,9 @@
#!/bin/bash
#PASSWD
id=$1
log_f="log.tmp"
center="mickael@172.16.131.74"
if [ "$PASS" = "" ]
then
@@ -11,10 +14,6 @@ then
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"
host=$USER"@"$(ip a | grep "inet " | tail -1 | cut -d " " -f 6 | cut -d "/" -f 1)
@@ -32,12 +31,15 @@ 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.tmp.sh $remote:agent.tmp.sh;
scp -o StrictHostKeyChecking=no $host:analyze.sh $remote:analyze.sh;
scp -o StrictHostKeyChecking=no $host:analyze.tmp.sh $remote:analyze.tmp.sh;
chmod u+x agent.tmp.sh;
chmod u+x analyze.sh;
./analyze.sh $log_f;
chmod u+x analyze.tmp.sh;
./analyze.tmp.sh $log_f;
scp -o StrictHostKeyChecking=no $log_f $center:log/log-$remote;
rm $log_f;
./agent.tmp.sh $id;"
fi
rm agent.tmp.sh 2> /dev/null
rm config 2> /dev/null
rm analyze.tmp.sh 2> /dev/null

0
config
View File

View File

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

15
launcher.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
agents=1
cp config-save config
cp analyze.sh analyze.tmp.sh
echo -n "password : "
read -s input
echo ""
for i in $(seq $agents)
do
echo $input | ./agent.sh $i
done