<s> import logging <EOL> import prox_guid <EOL> import pytail <EOL> import facebook <EOL> import ssid_to_loc <EOL> import os <EOL> import time <EOL> import sys <EOL> import signal <EOL> from multiprocessing import Process <EOL> snoopyBinPath = os . path . dirname ( os . path . realpath ( __file__ ) ) <EOL> sys . path . append ( "<STR_LIT>" % snoopyBinPath ) <EOL> from snoopy . web import main as webmain <EOL> webmain . app . root_path = "<STR_LIT>" % snoopyBinPath <EOL> goFlag = True <EOL> def signal_handler ( signal , frame ) : <EOL> global goFlag <EOL> logging . debug ( '<STR_LIT>' ) <EOL> goFlag = False <EOL> signal . signal ( signal . SIGINT , signal_handler ) <EOL> def main ( snoopyDir ) : <EOL> global goFlag <EOL> while ( goFlag ) : <EOL> logging . basicConfig ( filename = "<STR_LIT>" % ( snoopyDir ) , level = logging . INFO , format = '<STR_LIT>' , datefmt = '<STR_LIT>' ) <EOL> logging . info ( "<STR_LIT>" ) <EOL> logging . info ( "<STR_LIT>" ) <EOL> pool = [ ] <EOL> pool . append ( Process ( target = prox_guid . main ) ) <EOL> pool . append ( Process ( target = facebook . main , args = ( '<STR_LIT:%s>' % ( snoopyDir ) , ) ) ) <EOL> pool . append ( Process ( target = pytail . main , args = ( '<STR_LIT>' % ( snoopyDir ) , ) ) ) <EOL> pool . append ( Process ( target = ssid_to_loc . main ) ) <EOL> pool . append ( Process ( target = webmain . start ) ) <EOL> for p in pool : <EOL> p . start ( ) <EOL> all_good = True <EOL> while all_good and goFlag : <EOL> for p in pool : <EOL> if not p . is_alive ( ) : <EOL> all_good = False <EOL> time . sleep ( <NUM_LIT:2> ) <EOL> for p in pool : <EOL> p . terminate ( ) <EOL> if ( goFlag ) : <EOL> logging . warning ( "<STR_LIT>" ) <EOL> main ( snoopyDir ) <EOL> logging . debug ( "<STR_LIT>" ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> snoopyDir = sys . argv [ <NUM_LIT:1> ] <EOL> try : <EOL> main ( snoopyDir ) <EOL> except Exception , e : <EOL> logging . error ( "<STR_LIT>" % str ( e ) ) </s>
