oh gorram it.
This commit is contained in:
parent
a79802afa1
commit
e091d94f91
@ -338,14 +338,16 @@ def daemonMgr():
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
self_pidfile = '/tmp/sshsecure.pid'
|
self_pidfile = '/tmp/sshsecure.pid'
|
||||||
|
is_running = False
|
||||||
# First, check to see if we're already running.
|
# First, check to see if we're already running.
|
||||||
# This is where I'd put a psutil call... IF I HAD ONE.
|
# This is where I'd put a psutil call... IF I HAD ONE.
|
||||||
if os.path.isfile(self_pidfile):
|
if os.path.isfile(self_pidfile):
|
||||||
is_running = subprocess.run(['pgrep', '-F', self_pidfile], stdout = subprocess.PIPE)
|
is_running = subprocess.run(['pgrep', '-F', self_pidfile], stdout = subprocess.PIPE)
|
||||||
if is_running.stdout.decode('utf-8').strip() != '':
|
if is_running:
|
||||||
# We're still running. Exit gracefully.
|
if is_running.stdout.decode('utf-8').strip() != '':
|
||||||
print('We seem to still be running from a past execution; exiting')
|
# We're still running. Exit gracefully.
|
||||||
exit(0)
|
print('We seem to still be running from a past execution; exiting')
|
||||||
|
exit(0)
|
||||||
else:
|
else:
|
||||||
with open(self_pidfile, 'w') as f:
|
with open(self_pidfile, 'w') as f:
|
||||||
f.write(str(os.getpid()))
|
f.write(str(os.getpid()))
|
||||||
|
Loading…
Reference in New Issue
Block a user