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