Browse Source

remote sync command only if no user is given.

master
Dirk Alders 3 years ago
parent
commit
478de022cf
3 changed files with 12 additions and 7 deletions
  1. 3
    0
      .gitignore
  2. 5
    6
      example/sync_config.py
  3. 4
    1
      mysync

+ 3
- 0
.gitignore View File

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

+ 5
- 6
example/sync_config.py View File

4
 backup = False
4
 backup = False
5
 
5
 
6
 hosts = ['ahorn', 'erle', 'linde']
6
 hosts = ['ahorn', 'erle', 'linde']
7
-__basepath__ = '/user_data'
7
+__basepath__ = '/usr/data'
8
 entries = (
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
     ('dirk@%s:/home', '/home', None),
10
     ('dirk@%s:/home', '/home', None),
13
 )
11
 )
14
 
12
 
21
             setattr(sys.modules[__name__], host + '_' + os.path.basename(local) + '_skip', skip)
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 View File

68
     if localpath is not None:
68
     if localpath is not None:
69
         remotepath = path_filter(kwargs.get(PROP_REMOTE))
69
         remotepath = path_filter(kwargs.get(PROP_REMOTE))
70
         skip = kwargs.get(PROP_SKIP)
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
         if skip is not None:
75
         if skip is not None:
73
             cmd_l.append('--exclude=%s' % ','.join(skip))
76
             cmd_l.append('--exclude=%s' % ','.join(skip))
74
         if not os.path.exists(localpath):
77
         if not os.path.exists(localpath):

Loading…
Cancel
Save