diff --git a/simple_backup/simple_backup.py b/simple_backup/simple_backup.py index 18f8893..15fec5d 100755 --- a/simple_backup/simple_backup.py +++ b/simple_backup/simple_backup.py @@ -177,7 +177,14 @@ class Backup: self._remote = True if self._remote: - self._ssh = self._ssh_connect(homedir) + try: + self._ssh = self._ssh_connect(homedir) + except OSError as e: + # Unknown hostname, connection refused, unreachable host or timeout + logger.critical('Can\'t connect to the server %s', self.ssh_host) + logger.critical(e) + + return 5 if self._ssh is None: return 5