sudo date -s "$(curl -H'Cache-Control:no-cache' -sI google.com | grep '^Date:' | cut -d' ' -f3-6)Z"
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
| # check internet connection | |
| # @hostname str domain name | |
| # todo initial function | |
| #startup | |
| def is_connected(hostname='w.wiki'): | |
| logger.info(f'"trying to check connection"') | |
| while True: | |
| try: | |
| # see if we can resolve the host name -- tells us if there is | |
| # a DNS listening |
sudo date -s "$(curl -H'Cache-Control:no-cache' -sI google.com | grep '^Date:' | cut -d' ' -f3-6)Z"
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
| #! /usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| ############################################################## | |
| # Programa para Backup de Partições XFS. | |
| # André Filipe de Assuncao e Brito ([email protected]) | |
| # Fabricio Coutinho Medeiros ([email protected]) | |
| # This program is free software; you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation; either version 2 of the License, or | |
| # (at your option) any later version. |