Add --foreground and --verbose options as suggested in #87

This commit is contained in:
Patrick Ulbrich
2014-12-15 22:39:15 +01:00
parent cc164571b1
commit 823125c899
2 changed files with 11 additions and 2 deletions

View File

@@ -33,6 +33,7 @@ import os
import signal
from common.config import cfg_exists
from common.dist_cfg import APP_VERSION
from common.utils import set_procname, shutdown_existing_instance
from common.subproc import terminate_subprocesses
from common.exceptions import InvalidOperationException
@@ -67,8 +68,12 @@ def cleanup(daemon):
def get_args():
parser = argparse.ArgumentParser(prog=PROGNAME)
parser.add_argument('--quiet', action = 'store_true',
parser.add_argument('-q', '--quiet', action = 'store_true',
help = "don't print log messages to stdout")
parser.add_argument('-v', '--version', action = 'version',
version = 'Mailnag %s' % APP_VERSION)
parser.add_argument('-f', '--foreground', action = 'store_true',
help = "don't run mailnagd in daemon mode")
return parser.parse_args()

View File

@@ -2,5 +2,9 @@
LIB_DIR=./Mailnag
cd $(dirname $(readlink -f $0))
python2 $LIB_DIR/mailnag.py $@ &
if [ $# -eq 0 ] || [ $1 == "--quiet" ] || [ $1 == "-q" ]; then
python2 $LIB_DIR/mailnag.py $@ &
else
python2 $LIB_DIR/mailnag.py $@
fi