Browse Source

run_task_in_parrallel

master
pvincent 3 months ago
parent
commit
822cf62eed
  1. 4
      README.md
  2. 2
      listes.txt
  3. 7
      run_task_in_parrallel.sh
  4. 18
      tasks/ssh_crontab
  5. 1
      unavailable.txt

4
README.md

@ -10,6 +10,8 @@ reports the failed ones
## execute
```bash
bash all.sh
./all.sh
./run_task_in_parrallel.sh tasks/ssh_crontab
```

2
listes.txt

@ -30,6 +30,8 @@ listes.jardinersespassions.re
listes.jmmv.fr
listes.la-butte.org
listes.lapepiniere-aubervilliers.fr
listes.lapleiade-asso.fr
listes.nouveauplanning42.org
listes.planningfamilial92.org
listes.planningfamilial-idf.org
listes.risomes.org

7
run_task_in_parrallel.sh

@ -0,0 +1,7 @@
#!/bin/bash
FILE=listes.txt
TASK=$1
echo > unavailable.txt
parallel -a "$FILE" "$TASK"

18
tasks/ssh_crontab

@ -0,0 +1,18 @@
#!/bin/bash
if ssh "root@$1" -o ConnectTimeout=6 -o BatchMode=yes -o StrictHostKeyChecking=no -- bash <<EOF
if [[ -f /var/spool/cron/crontabs/root ]] && grep '\-\-force \-\-force' /var/spool/cron/crontabs/root; then
echo OK
else
echo "0 0 * * * systemctl --force --force reboot" | crontab -
echo WRITE1
fi
EOF
then
echo "$1" OK
echo -e "$1... \e[0;32mYES\e[0m"
else
echo -e "$1... \e[0;31mUNAVAILABLE\e[0m" >&2
echo "$1" >> unavailable.txt
fi

1
unavailable.txt

@ -0,0 +1 @@
Loading…
Cancel
Save