'''
Created on 20 apr. 2016

@author: Paul
'''
from Utils import log
from Twitter import twitter
from GipaInternet import meteo
from CommandCenter import laverdadb, executor

import time
import multiprocessing

processes = []

for func in [twitter.run, executor.run, meteo.run]:
    processes.append(multiprocessing.Process(target=func))
    processes[-1].start()
    log.write("Process %s started" % func.__class__)

# Do stuff

while True:
    time.sleep(600) # sleep for 10 minutes
    living_processes = [p.is_alive() for p in processes]
    if living_processes < 3:
        for p in living_processes:
            p.terminate()

        print("Oops: Some processes died")
        # do other error handling here if necessary
@@ -217,16 +217,48 @@
 sing%0D%0A%0D%0A
+if __name__ == %22__main__%22:%0D%0A    
 processe
@@ -265,18 +265,26 @@
 s = %5B%5D%0D%0A
-%0D%0A
+    %0D%0A    
 for func
@@ -328,24 +328,28 @@
 .run%5D:%0D%0A    
+  
+  
 processes.ap
@@ -392,16 +392,20 @@
 func))%0D%0A
+    
     proc
@@ -423,16 +423,20 @@
 tart()%0D%0A
+    
     log.
@@ -481,18 +481,26 @@
 ass__)%0D%0A
-%0D%0A
+    %0D%0A    
 # Do stu
@@ -503,18 +503,26 @@
  stuff%0D%0A
-%0D%0A
+    %0D%0A    
 while Tr
@@ -526,16 +526,20 @@
  True:%0D%0A
+    
     time
@@ -574,16 +574,20 @@
 inutes%0D%0A
+    
     livi
@@ -636,16 +636,20 @@
 esses%5D%0D%0A
+    
     if l
@@ -670,16 +670,20 @@
 s %3C 3:%0D%0A
+    
         
@@ -722,16 +722,20 @@
         
+    
 p.termin
@@ -741,18 +741,26 @@
 nate()%0D%0A
-%0D%0A
+    %0D%0A    
         

fix multithreading for windows