You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
497 B

  1. #!/bin/bash
  2. if ssh "root@$1" -o ConnectTimeout=6 -o BatchMode=yes -o StrictHostKeyChecking=no -- bash <<EOF
  3. if [[ -f /var/spool/cron/crontabs/root ]] && grep '\-\-force \-\-force' /var/spool/cron/crontabs/root; then
  4. echo OK
  5. else
  6. echo "0 0 * * * systemctl --force --force reboot" | crontab -
  7. echo WRITE1
  8. fi
  9. EOF
  10. then
  11. echo "$1" OK
  12. echo -e "$1... \e[0;32mYES\e[0m"
  13. else
  14. echo -e "$1... \e[0;31mUNAVAILABLE\e[0m" >&2
  15. echo "$1" >> unavailable.txt
  16. fi