|
|
@ -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 |