From 130074788a87107748ae2dd921921890621aef77 Mon Sep 17 00:00:00 2001 From: brent s Date: Fri, 15 Sep 2017 09:56:11 -0400 Subject: [PATCH] get cron to shut the hell up. too. many. emails. --- arch/repoclone.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/repoclone.py b/arch/repoclone.py index 13a7355..8e73f31 100755 --- a/arch/repoclone.py +++ b/arch/repoclone.py @@ -6,6 +6,7 @@ import datetime import os import pprint import subprocess +import sys cfgfile = os.path.join(os.environ['HOME'], '.arch.repoclone.ini') @@ -49,7 +50,11 @@ def sync(args): if os.path.isfile(args['lockfile']): with open(args['lockfile'], 'r') as f: existingpid = f.read().strip() - exit('!! A repo synchronization seems to already be running (PID: {0}). Quitting. !!'.format(existingpid)) + if os.isatty(sys.stdin.fileno()): + # Running from shell + exit('!! A repo synchronization seems to already be running (PID: {0}). Quitting. !!'.format(existingpid)) + else: + exit() # we're running in cron, shut the hell up. else: with open(args['lockfile'], 'w') as f: f.write(str(os.getpid()))