sshfs map user, rsync backup with remote option
This commit is contained in:
@@ -8,13 +8,14 @@ import shlex
|
||||
import json
|
||||
from argparse import ArgumentParser
|
||||
|
||||
VERSION = "1.2"
|
||||
VERSION = "1.3"
|
||||
|
||||
|
||||
class RSB:
|
||||
def __init__(self, options):
|
||||
self.options = options
|
||||
self.lock = options.lock
|
||||
self.no_backup = options.no_backup
|
||||
self.base_folder = options.base_folder
|
||||
self.backup_source = options.backup_source
|
||||
self.rsync_args = options.rsync_args
|
||||
@@ -105,6 +106,10 @@ class RSB:
|
||||
subprocess.call(["cp", "-la", self.current, tgt_dir], shell=False)
|
||||
|
||||
def make_backup(self):
|
||||
if self.options.no_backup:
|
||||
print("Not making backup, as requested")
|
||||
return True
|
||||
|
||||
print("Backing up")
|
||||
command = [
|
||||
"rsync",
|
||||
@@ -202,7 +207,15 @@ def get_opts():
|
||||
default=False,
|
||||
help="Use locking to prevent concurrent backups",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--no-backup",
|
||||
dest="no_backup",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Do not rsync for backup, only create hardlinks, and clean up. Use this when backuping to a remote machine, and run it at the remote matchine. Example: rsync -a --del ~/ remote:backups/home/current/; ssh remote rsync-backup --no-backup ~/ backups/home/",
|
||||
)
|
||||
parser.add_argument("--version", action="version", version=VERSION)
|
||||
|
||||
parser.add_argument(
|
||||
"backup_source", action="store", help="Source URL to backup with rsync"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user