rendered paste body#!/usr/bin/python"""homeunison.py"""import os, sys, timelockfile = "/tmp/homeunison.lock"locked = 0for i in range(100): if locked: break try: if not os.path.exists(lockfile): open(lockfile, "w").write("%d" % os.getpid()) continue except: print "not found, not writing" pass try: if os.path.exists(lockfile): pid = open(lockfile).readline() if pid.isdigit(): if int(pid) == os.getpid(): locked = 1 continue except: pass try: if os.path.exists("/proc/%s" % pid): if not "homeunison" in open("/proc/%s/cmdline").readline(): os.remove(lockfile) continue except: pass time.sleep(0.15)if locked: """Do Stuff"""try: os.remove(lockfile)except: pass