sshfs map user, rsync backup with remote option
This commit is contained in:
@@ -8,13 +8,14 @@ import shlex
|
|||||||
import json
|
import json
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
VERSION = "1.2"
|
VERSION = "1.3"
|
||||||
|
|
||||||
|
|
||||||
class RSB:
|
class RSB:
|
||||||
def __init__(self, options):
|
def __init__(self, options):
|
||||||
self.options = options
|
self.options = options
|
||||||
self.lock = options.lock
|
self.lock = options.lock
|
||||||
|
self.no_backup = options.no_backup
|
||||||
self.base_folder = options.base_folder
|
self.base_folder = options.base_folder
|
||||||
self.backup_source = options.backup_source
|
self.backup_source = options.backup_source
|
||||||
self.rsync_args = options.rsync_args
|
self.rsync_args = options.rsync_args
|
||||||
@@ -105,6 +106,10 @@ class RSB:
|
|||||||
subprocess.call(["cp", "-la", self.current, tgt_dir], shell=False)
|
subprocess.call(["cp", "-la", self.current, tgt_dir], shell=False)
|
||||||
|
|
||||||
def make_backup(self):
|
def make_backup(self):
|
||||||
|
if self.options.no_backup:
|
||||||
|
print("Not making backup, as requested")
|
||||||
|
return True
|
||||||
|
|
||||||
print("Backing up")
|
print("Backing up")
|
||||||
command = [
|
command = [
|
||||||
"rsync",
|
"rsync",
|
||||||
@@ -202,7 +207,15 @@ def get_opts():
|
|||||||
default=False,
|
default=False,
|
||||||
help="Use locking to prevent concurrent backups",
|
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("--version", action="version", version=VERSION)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"backup_source", action="store", help="Source URL to backup with rsync"
|
"backup_source", action="store", help="Source URL to backup with rsync"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ if [[ $device1 = $device2 ]]; then
|
|||||||
|
|
||||||
eval sshfs \
|
eval sshfs \
|
||||||
-o reconnect \
|
-o reconnect \
|
||||||
|
-o uid=`id -u` \
|
||||||
|
-o gid=`id -g` \
|
||||||
-o ServerAliveInterval=45,ServerAliveCountMax=2 \
|
-o ServerAliveInterval=45,ServerAliveCountMax=2 \
|
||||||
$NOSAVE \
|
$NOSAVE \
|
||||||
-o follow_symlinks "$valid_name$path" "$valid_name"
|
-o follow_symlinks "$valid_name$path" "$valid_name"
|
||||||
|
|||||||
Reference in New Issue
Block a user