X-Git-Url: http://git.treefish.org/~alex/photosort.git/blobdiff_plain/e7b340f1a05c4ef9a28a427d34ff12f14113c95c..f74cea71b4539995483ec2393f22d7592d03632b:/src/photosort-daemon.py diff --git a/src/photosort-daemon.py b/src/photosort-daemon.py index cdd652d..e345b83 100755 --- a/src/photosort-daemon.py +++ b/src/photosort-daemon.py @@ -5,6 +5,7 @@ import json import logging import os import signal +import sys import time from bunch import Bunch @@ -30,13 +31,16 @@ logging.basicConfig(format='[%(asctime)s] %(levelname)s: %(message)s', level=logging.getLevelName(args.log_lvl), datefmt='%m/%d/%Y %H:%M:%S') +status = 0 + with open(args.config_file) as f: cfg = json.load(f) +bunch_idx = 1 bunches = [] for bunch_cfg in cfg['bunches']: - bunches.append( Bunch(bunch_cfg) ) - + bunches.append( Bunch(bunch_idx, bunch_cfg) ) + bunch_idx += 1 for bunch in bunches: bunch.start() @@ -45,7 +49,10 @@ while not stop: for bunch in bunches: if not bunch.is_running(): stop = True + status = 1 time.sleep(2.0) for bunch in bunches: bunch.stop() + +sys.exit(status)