summaryrefslogtreecommitdiffstats
path: root/retiolum/hosts/.scripts/tinc_multicast
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
commit4f30333372644e78cd217299ef66ef434088a970 (patch)
tree19973a486717dd21a0a557cc0b06ed11a63baca9 /retiolum/hosts/.scripts/tinc_multicast
parent2df8f3670e49aad9c76d37ea79fbde87c81c8ac3 (diff)
making now pidfile in /var/lock
Diffstat (limited to 'retiolum/hosts/.scripts/tinc_multicast')
-rwxr-xr-xretiolum/hosts/.scripts/tinc_multicast/retiolum.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/retiolum/hosts/.scripts/tinc_multicast/retiolum.py b/retiolum/hosts/.scripts/tinc_multicast/retiolum.py
index f8272088..cd226fc9 100755
--- a/retiolum/hosts/.scripts/tinc_multicast/retiolum.py
+++ b/retiolum/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))