Compare commits

..

No commits in common. "b0b417fd57f243cec2d679a618fdee2ae4e67132" and "864bf1de99fa1238119ebfc20bceebca7dbc2a48" have entirely different histories.

4 changed files with 13 additions and 39 deletions

19
.gitignore vendored
View File

@ -1,25 +1,6 @@
config.py
# ---> Eclipse
.project
.pydevproject
.settings
# ---> Linux
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/

View File

@ -2,14 +2,13 @@ import os
import sys
backup = True
host = 'erle'
backup_basepath = '/data/backup/data'
backup_basepath = '/data/backup/ahorn'
installations = ['mint', 'kubuntu', 'openSuSE']
for installation in installations:
setattr(sys.modules[__name__], 'home_%s_remotepath' % installation, 'dirk@%s:/home' % host)
setattr(sys.modules[__name__], 'home_%s_remotepath' % installation, 'dirk@ahorn:/home')
setattr(sys.modules[__name__], 'home_%s_localpath' % installation, os.path.join(installation, 'home'))
data_remotepath = 'dirk@%s:/usr/data' % host
data_localpath = 'usr/data'
data_skip = ['lost+found', 'dirk/Audio', 'dirk/bin', 'dirk/gnome-boxes', 'dirk/media_images', 'dirk/Videos']
user_data_remotepath = 'dirk@ahorn:/user_data'
user_data_localpath = 'user_data'
user_data_skip = ['static_data']

View File

@ -3,25 +3,22 @@ import sys
backup = False
hosts = ['ahorn', 'erle', 'linde']
hosts = ['ahorn', 'buche', 'erle', 'linde']
__basepath__ = '/usr/data'
entries = (
('dirk@%s:/usr/data', __basepath__, ['lost+found']),
('dirk@%s:/usr/data', __basepath__, ['lost+found', 'dirk/Audio', 'dirk/bin', 'dirk/Downloads', 'dirk/gnome-boxes', 'dirk/media_images', 'dirk/Videos']),
('dirk@%s:/usr/data', __basepath__, None),
('dirk@%s:/home', '/home', None),
)
for host in hosts:
for remote, local, skip in entries:
name = os.path.basename(local)
setattr(sys.modules[__name__], host + '_' + os.path.basename(local) + '_remotepath', remote % host)
setattr(sys.modules[__name__], host + '_' + os.path.basename(local) + '_localpath', local)
if skip is not None:
if len(skip) > 1:
name += '_short'
setattr(sys.modules[__name__], host + '_' + name + '_skip', skip)
setattr(sys.modules[__name__], host + '_' + name + '_remotepath', remote % host)
setattr(sys.modules[__name__], host + '_' + name + '_localpath', local)
setattr(sys.modules[__name__], host + '_' + os.path.basename(local) + '_skip', skip)
mount_mockery_audio_remotepath = 'root@mount-mockery.de:/data/audio'
mount_mockery_audio_localpath = os.path.join(__basepath__, 'dirk', 'Audio')

7
mysync
View File

@ -10,7 +10,7 @@ import subprocess
DEBUG = False
RSYNC_REMOTE_COMMAND = 'rsync'
RSYNC_REMOTE_COMMAND = 'sudo rsync'
TIME_FORMAT = "%Y-%m-%d_%H-%M-%S"
try:
basepath = config.backup_basepath
@ -73,10 +73,7 @@ def rsync_command(**kwargs):
else:
cmd_l = ['rsync', '-avn' if DEBUG else '-av', '--delete', '--rsync-path="%s"' % RSYNC_REMOTE_COMMAND, remotepath, localpath]
if skip is not None:
for skip_dir in skip:
if not skip_dir.endswith('/'):
skip_dir += '/'
cmd_l.append('--exclude=%s' % skip_dir)
cmd_l.append('--exclude=%s' % ','.join(skip))
if not os.path.exists(localpath):
return 'mkdir -p %s && ' % localpath + ' '.join(cmd_l)
return ' '.join(cmd_l)