Commit b0d8ccd7 authored by Daniel Armbruster's avatar Daniel Armbruster Committed by thomas.forbriger
Browse files

-a flag superflous - see ticket:160

This is a legacy commit from before 2015-05-18.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.

SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 4386
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 0b94b421
......@@ -33,7 +33,6 @@
#
# REVISIONS and CHANGES
# 05/12/2012 V0.1 Daniel Armbruster
# 11/01/2012 V0.4 pid lockfile handler ability added
#
# =============================================================================
"""
......@@ -78,7 +77,7 @@ class Usage(Error):
Usage: csbackmail [-v|--verbose] [-d|--debug] [-l|--logging] -P|--port ARG
-H|--host ARG -u|--username ARG -p|--password ARG
-r|--receiver ADDRESS [-r|--receiver ADDRESS [...]]
-s|--sender ADDRESS [-a|--announce] [PATH [PATH [...]]]
-s|--sender ADDRESS [-L|--lock] [PATH [PATH [...]]]
or: csbackmail -h|--help\n"""
sys.stderr.write("csbackmail [line "+self.line+"]: "+self.msg+"\n")
sys.stderr.write(usage_text)
......@@ -93,7 +92,7 @@ def help():
Usage: csbackmail [-v|--verbose] [-d|--debug] [-l|--logging] -P|--port ARG
-H|--host ARG -u|--username ARG -p|--password ARG
-r|--receiver ADDRESS [-r|--receiver ADDRESS [...]]
-s|--sender ADDRESS [-a|--announce] [PATH [PATH [...]]]
-s|--sender ADDRESS [-L|--lock] [PATH [PATH [...]]]
or: csbackmail -h|--help
-------------------------------------------------------------------------------
-v|--verbose Be verbose.
......@@ -108,11 +107,6 @@ def help():
-H|--host ARG Hostname of the SMTP server.
-u|--username ARG Username for SMTP server login.
-p|--password ARG Password for SMTP server login.
-a|--announce Announce csbackmail to the csback pid lockfilehandler. This
flag is neccessary if several csback processes were run
simultaneously and the '-l|--logging' option is enabled.
Otherwise problems with the logging mechanism could
occur.
PATH Path(s) of the logfile(s) to check. If not specified the
logfiles in ~/.csback/log/ were investigated.
"""
......@@ -132,11 +126,11 @@ def main(argv=None):
argv = sys.argv
try:
try:
opts, args = getopt.getopt(argv[1:], "vhdlr:s:P:H:u:p:a", ["help", \
opts, args = getopt.getopt(argv[1:], "vhdlr:s:P:H:u:p:", ["help", \
"verbose", "debug", "logging", "receiver=", "sender=", "port=", \
"host=", "username=", "password=", "announce"])
"host=", "username=", "password="])
except getopt.GetoptError as err:
raise Usage(131,err.msg)
raise Usage(133,err.msg)
verbose = False
debugMode = False
receivers = []
......@@ -145,7 +139,6 @@ def main(argv=None):
host = ''
username = ''
password = ''
pidAnnounce = False
# collect commandline arguments
for opt, arg in opts:
if opt in ("-v", "--verbose"):
......@@ -171,20 +164,12 @@ def main(argv=None):
username = arg
elif opt in ("-p", "--password"):
password = arg
elif opt in ("-a", "--announce"):
pidAnnounce = True
else:
raise Usage(167,"Unhandled option chosen.")
raise Usage(168,"Unhandled option chosen.")
if verbose or debugMode:
logger.addHandler(console)
# announce to pidlock
if pidAnnounce:
pidhandler = pidlock.PidHandler()
pidhandler.announce(os.getpid())
# fetching and checking arguments
if 1 <= len(args):
logger.getLogger().info("Taking passed PATH(s) as arguments.")
logFilePathes = [str(arg).rstrip(os.sep)+os.sep for arg in args]
......@@ -312,9 +297,6 @@ def main(argv=None):
else:
session.quit()
# remove from pidlock
if pidAnnounce:
pidhandler.cancel(os.getpid())
except Usage as err:
err.display()
return 2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment