diff --git a/simple_backup/simple_backup.py b/simple_backup/simple_backup.py index 36b3833..27cb4ca 100755 --- a/simple_backup/simple_backup.py +++ b/simple_backup/simple_backup.py @@ -615,37 +615,22 @@ class Backup: if self._remote: assert self._ssh is not None - _, stdout, _ = self._ssh.exec_command( - f'if [ -d "{self._output_dir}" ]; then echo "ok"; fi') + self._ssh.close() - output = stdout.read().decode('utf-8').strip() + if returncode != 0: + logger.error( + 'Some errors occurred while performing the backup') - if output == 'ok': - logger.info('Backup completed') + _notify( + 'Some errors occurred while performing the backup. Check log for details') - _notify('Backup completed') - else: - logger.error('Backup failed') + return 4 - _notify('Backup failed (check log for details)') + logger.info('Backup completed') - if self._ssh: - self._ssh.close() - else: - if returncode != 0: - logger.error( - 'Some errors occurred while performing the backup') + _notify('Backup completed') - _notify( - 'Some errors occurred while performing the backup. Check log for details') - - return 4 - - logger.info('Backup completed') - - _notify('Backup completed') - - return 0 + return 0 def _detect_user() -> Optional[str]: