Kaynağa Gözat

remote sync command only if no user is given.

master
Dirk Alders 3 yıl önce
ebeveyn
işleme
478de022cf
3 değiştirilmiş dosya ile 12 ekleme ve 7 silme
  1. 3
    0
      .gitignore
  2. 5
    6
      example/sync_config.py
  3. 4
    1
      mysync

+ 3
- 0
.gitignore Dosyayı Görüntüle

@@ -1,3 +1,6 @@
1
+config.py
2
+*~
3
+
1 4
 # ---> Python
2 5
 # Byte-compiled / optimized / DLL files
3 6
 __pycache__/

+ 5
- 6
example/sync_config.py Dosyayı Görüntüle

@@ -4,11 +4,9 @@ import sys
4 4
 backup = False
5 5
 
6 6
 hosts = ['ahorn', 'erle', 'linde']
7
-__basepath__ = '/user_data'
7
+__basepath__ = '/usr/data'
8 8
 entries = (
9
-    ('dirk@%s:/user_data/bin', os.path.join(__basepath__, 'bin'), None),
10
-    ('dirk@%s:/user_data/data', os.path.join(__basepath__, 'data'), None),
11
-    ('dirk@%s:/user_data/static_data', os.path.join(__basepath__, 'static_data'), ['Audio', 'timeshift', 'lost+found']),
9
+    ('dirk@%s:/usr/data', __basepath__, None),
12 10
     ('dirk@%s:/home', '/home', None),
13 11
 )
14 12
 
@@ -21,5 +19,6 @@ for host in hosts:
21 19
             setattr(sys.modules[__name__], host + '_' + os.path.basename(local) + '_skip', skip)
22 20
 
23 21
 
24
-mount_mockery_audio_remotepath = 'root@mount-mockery.de:/data/audio/items'
25
-mount_mockery_audio_localpath = os.path.join(__basepath__, 'static_data', 'dirk', 'Audio')
22
+mount_mockery_audio_remotepath = 'root@mount-mockery.de:/data/audio'
23
+mount_mockery_audio_localpath = os.path.join(__basepath__, 'dirk', 'Audio')
24
+

+ 4
- 1
mysync Dosyayı Görüntüle

@@ -68,7 +68,10 @@ def rsync_command(**kwargs):
68 68
     if localpath is not None:
69 69
         remotepath = path_filter(kwargs.get(PROP_REMOTE))
70 70
         skip = kwargs.get(PROP_SKIP)
71
-        cmd_l = ['rsync', '-avn' if DEBUG else '-av', '--delete', '--rsync-path="%s"' % RSYNC_REMOTE_COMMAND, remotepath, localpath]
71
+        if remotepath.find('@') != -1:
72
+            cmd_l = ['rsync', '-avn' if DEBUG else '-av', '--delete', remotepath, localpath]
73
+        else:
74
+            cmd_l = ['rsync', '-avn' if DEBUG else '-av', '--delete', '--rsync-path="%s"' % RSYNC_REMOTE_COMMAND, remotepath, localpath]
72 75
         if skip is not None:
73 76
             cmd_l.append('--exclude=%s' % ','.join(skip))
74 77
         if not os.path.exists(localpath):

Loading…
İptal
Kaydet