get cron to shut the hell up. too. many. emails.
This commit is contained in:
parent
30f508f40c
commit
130074788a
@ -6,6 +6,7 @@ import datetime
|
|||||||
import os
|
import os
|
||||||
import pprint
|
import pprint
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
cfgfile = os.path.join(os.environ['HOME'], '.arch.repoclone.ini')
|
cfgfile = os.path.join(os.environ['HOME'], '.arch.repoclone.ini')
|
||||||
|
|
||||||
@ -49,7 +50,11 @@ def sync(args):
|
|||||||
if os.path.isfile(args['lockfile']):
|
if os.path.isfile(args['lockfile']):
|
||||||
with open(args['lockfile'], 'r') as f:
|
with open(args['lockfile'], 'r') as f:
|
||||||
existingpid = f.read().strip()
|
existingpid = f.read().strip()
|
||||||
|
if os.isatty(sys.stdin.fileno()):
|
||||||
|
# Running from shell
|
||||||
exit('!! A repo synchronization seems to already be running (PID: {0}). Quitting. !!'.format(existingpid))
|
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:
|
else:
|
||||||
with open(args['lockfile'], 'w') as f:
|
with open(args['lockfile'], 'w') as f:
|
||||||
f.write(str(os.getpid()))
|
f.write(str(os.getpid()))
|
||||||
|
Loading…
Reference in New Issue
Block a user