]> git.parisson.com Git - telecaster-client.git/commitdiff
add rsync test to avoid multiple uploads
authoryomguy <yomguy@parisson.com>
Mon, 16 Jul 2012 09:51:12 +0000 (11:51 +0200)
committeryomguy <yomguy@parisson.com>
Mon, 16 Jul 2012 09:51:12 +0000 (11:51 +0200)
telecaster/management/commands/telecaster-rsync-archives.py
telecaster/tools/tools.py

index f4c4196ab7b4efb9bcdaebaf49c030a6ae9b84b1..bf8f598b2a734bb07f64124b519ed53d193f5560 100644 (file)
@@ -17,18 +17,19 @@ class Command(BaseCommand):
     server = settings.TELECASTER_RSYNC_SERVER
     log = settings.TELECASTER_RSYNC_LOG
     logger = Logger(log)
-    command = 'rsync -aq ' 
-    
+    command = 'rsync -aq '
+
     def handle(self, *args, **options):
-        stations = Station.objects.filter(started=True)
-        ids = [station.public_id for station in stations]
-        if ids:
-            for id in ids:
-                self.command += '--exclude=%s ' % id
-        self.command += self.archives + ' ' + self.server
-        try:
-            os.system(self.command)
-            self.logger.write_info(self.command)
-        except:
-            self.logger.write_error('NOT rsynced')
-        
\ No newline at end of file
+        pid = get_pid('rsync')
+        if not pid:
+            stations = Station.objects.filter(started=True)
+            ids = [station.public_id for station in stations]
+            if ids:
+                for id in ids:
+                    self.command += '--exclude=%s ' % id
+            self.command += self.archives + ' ' + self.server
+            try:
+                os.system(self.command)
+                self.logger.write_info(self.command)
+            except:
+                self.logger.write_error('NOT rsynced')
index 1d0921f525306804603a2860f92219947bcbe57b..058250fac42df691e86d128773bb008841c0b8f8 100644 (file)
@@ -103,14 +103,6 @@ def xml2dict(conf_file):
     dict = xmltodict(conf_xml,'utf-8')
     return dict
 
-import psutil
-
-PROCNAME = "deefuzzer"
-PROCARGS = ".telecaster/deefuzzer_webm.xml"
-
-
-
-
 def get_pid(name, args=None):
     """Get a process pid filtered by arguments and uid"""
     pids = []