From 6266a401677a928bb3baa459d655ab745e1462d5 Mon Sep 17 00:00:00 2001 From: Lassulus Date: Tue, 24 May 2011 16:01:43 +0200 Subject: making now pidfile in /var/lock --- hosts/.scripts/tinc_multicast/retiolum.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'hosts/.scripts') diff --git a/hosts/.scripts/tinc_multicast/retiolum.py b/hosts/.scripts/tinc_multicast/retiolum.py index f8272088..cd226fc9 100755 --- a/hosts/.scripts/tinc_multicast/retiolum.py +++ b/hosts/.scripts/tinc_multicast/retiolum.py @@ -273,6 +273,10 @@ if option.hostname == "default": hostname = option.hostname netname = option.netname +#set process name +pidfile = open("/var/lock/retiolum." + netname, "w") +pidfile.write(str(os.getpid())) +pidfile.close() #Logging stuff LEVELS = {'3' : logging.DEBUG, @@ -284,16 +288,20 @@ level_name = option.debug level = LEVELS.get(level_name, logging.NOTSET) logging.basicConfig(level=level) +#download and untar hostfile get_hostfiles(netname, "http://vpn.miefda.org/hosts.tar.gz", "http://vpn.miefda.org/hosts.md5") tar = subprocess.call(["tar -xzf /etc/tinc/" + netname + "/hosts/hosts.tar.gz -C /etc/tinc/" + netname + "/hosts/"], shell=True) +#normally tinc doesnt start with retiolum if option.tinc != False: start_tincd = subprocess.call(["tincd -n " + netname ],shell=True) +#initialize fifos sendfifo = Queue.Queue() #sendtext authfifo = Queue.Queue() #Stage{1, 2, 3} hostname ip enc_data timeoutfifo = Queue.Queue() #State{tst, add} hostname ip +#start threads thread_recv = thread.start_new_thread(recvthread, (netname, hostname, timeoutfifo, authfifo)) thread_send = thread.start_new_thread(sendthread, (netname, hostname, sendfifo, option.ghost)) thread_timeout = thread.start_new_thread(timeoutthread, (netname, timeoutfifo, authfifo)) -- cgit v1.2.3