moving refresh-peer.py with MyPLC where it belongs
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 28 May 2008 09:16:51 +0000 (09:16 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 28 May 2008 09:16:51 +0000 (09:16 +0000)
build-native.sh
build.sh
refresh-peer.py [new file with mode: 0644]

index 6594cba..5bcc593 100755 (executable)
@@ -29,6 +29,7 @@ install -D -m 755 plc-config-tty ${tmpdir}/usr/bin/plc-config-tty
 install -D -m 755 db-config ${tmpdir}/usr/bin/db-config
 install -D -m 755 dns-config ${tmpdir}/usr/bin/dns-config
 install -D -m 755 plc-map.py ${tmpdir}/usr/bin/plc-map.py
+install -D -m 755 refresh-peer.py ${tmpdir}/usr/bin/refresh-peer.py
 install -D -m 755 clean-empty-dirs.py ${tmpdir}/usr/bin/clean-empty-dirs.py
 install -D -m 755 mtail.py ${tmpdir}/usr/bin/mtail.py
 install -D -m 755 check-ssl-peering.py ${tmpdir}/usr/bin/check-ssl-peering.py
index 4a2c6d2..7fa29c3 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -64,6 +64,7 @@ install -D -m 755 plc-config-tty root/usr/bin/plc-config-tty
 install -D -m 755 db-config root/usr/bin/db-config
 install -D -m 755 dns-config root/usr/bin/dns-config
 install -D -m 755 plc-map.py root/usr/bin/plc-map.py
+install -D -m 755 refresh-peer.py root/usr/bin/refresh-peer.py
 install -D -m 755 clean-empty-dirs.py root/usr/bin/clean-empty-dirs.py
 install -D -m 755 mtail.py root/usr/bin/mtail.py
 install -D -m 755 check-ssl-peering.py root/usr/bin/check-ssl-peering.py
diff --git a/refresh-peer.py b/refresh-peer.py
new file mode 100644 (file)
index 0000000..127544f
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/env plcsh
+# $Id$
+
+import sys,os,time
+
+def Run (peername):
+    timestring=time.strftime("%Y-%m-%d-%H-%M-%S")
+    print 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',peername
+    print 'RefreshPeer on %s - starting on %s'%(peername,timestring)
+    print 'xxxxxxxxxx'
+    sys.stdout.flush()
+    start=time.time()
+    result=RefreshPeer(peername)
+    finish=time.time()
+
+    print 'Total duration',finish-start
+    print 'xxxxxxxxxx timers:'
+    keys=result.keys()
+    keys.sort()
+    for key in keys:
+        print key,result[key]
+    sys.stdout.flush()
+    sys.stderr.flush()
+
+def RunInLog (peername):
+    monthstring=time.strftime("%Y-%m")
+    logname="/var/log/refresh-peer-%s-%s.log"%(peername,monthstring)
+    sys.stdout=open(logname,'a')
+    sys.stderr=sys.stdout
+    Run(peername)
+    sys.stderr.close()
+    sys.stdout.close()
+
+if __name__ == "__main__":
+    
+    for peername in sys.argv[1:]:
+        RunInLog (peername)
+
+