summaryrefslogtreecommitdiffstats
path: root/hosts/.scripts
diff options
context:
space:
mode:
authorLassulus <Lassulus@googlemail.com>2011-05-24 16:01:43 +0200
committerLassulus <Lassulus@googlemail.com>2011-05-24 16:01:43 +0200
commit6266a401677a928bb3baa459d655ab745e1462d5 (patch)
tree9302dab99d92d5c7dc21c2e9745c6d6d73d00634 /hosts/.scripts
parentd5f370a12d098c26f845deccb83f621975303f81 (diff)
making now pidfile in /var/lock
Diffstat (limited to 'hosts/.scripts')
-rwxr-xr-xhosts/.scripts/tinc_multicast/retiolum.py8
1 files changed, 8 insertions, 0 deletions
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))