import


In [1]:
import auto_swap

set up your args


In [4]:
sslocal_path = !which sslocal
print sslocal_path


['/usr/bin/sslocal']

In [5]:
exec_path = sslocal_path[0]
config_path = "ssproxy.json"
duration = 1
host_list = "servers.list"

run


In [3]:
looper = auto_swap.Looper(exec_path, config_path, duration, host_list)
looper.start_looper()


ping...
1/27
2/27
3/27
4/27
5/27
6/27
7/27
8/27
9/27
13/27
10/27
11/27
16/27
19/27
21/27
18/27
20/27
15/27
17/27
14/27
22/27
13/27
24/27
23/27
27/27
26/27
25/27
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-3-234be5c28b2d> in <module>()
      1 looper = auto_swap.Looper(exec_path, config_path, duration, host_list)
----> 2 looper.start_looper()

/home/lordsimon/4fun/server_monitor/auto_swap.pyc in start_looper(self, using_thread)
     88             print "still in working..."
     89         else:
---> 90             self.loop()
     91         pass
     92 

/home/lordsimon/4fun/server_monitor/auto_swap.pyc in loop(self)
     27         while self.started is True:
     28             #find fastest server
---> 29             states = self.monitor.check_all()
     30 
     31             if states[0].state > 0:

/home/lordsimon/4fun/server_monitor/monitor.pyc in check_all(self)
     95             t.start()
     96         for t in threads:
---> 97             t.join()
     98         self.check_all_res_up = sorted(self.check_all_res_up, key = lambda state:state.time)
     99         print "result:"

/usr/lib/python2.7/threading.pyc in join(self, timeout)
    938             if timeout is None:
    939                 while not self.__stopped:
--> 940                     self.__block.wait()
    941                 if __debug__:
    942                     self._note("%s.join(): thread stopped", self)

/usr/lib/python2.7/threading.pyc in wait(self, timeout)
    338         try:    # restore state no matter what (e.g., KeyboardInterrupt)
    339             if timeout is None:
--> 340                 waiter.acquire()
    341                 if __debug__:
    342                     self._note("%s.wait(): got it", self)

KeyboardInterrupt: 

In [ ]: