diff --git a/tsshbatch.py b/tsshbatch.py index 274c0e8..8215c8f 100755 --- a/tsshbatch.py +++ b/tsshbatch.py @@ -20,7 +20,7 @@ CMDINCL = PROGENV + "CMDS" HOSTINCL = PROGENV + "HOSTS" -CVSID = "$Id: tsshbatch.py,v 1.182 2014/03/28 20:47:43 tundra Exp $" +CVSID = "$Id: tsshbatch.py,v 1.183 2014/03/28 21:12:26 tundra Exp $" VERSION = CVSID.split()[2] CPRT = "(c)" DATE = "2011-2014" @@ -69,7 +69,7 @@ HOSTNOISE = '[%s]' HOSTLIST = 'Hosts' INDENTWIDTH = 8 -OPTIONSLIST = 'KG:H:NP:ST:ef:hkn:p:tvxy' +OPTIONSLIST = 'KG:H:NP:ST:aef:hkn:p:tvxy' PADWIDTH = 12 PATHDELIM = ':' PATHSEP = os.sep @@ -88,7 +88,7 @@ USAGE = \ PROGVER + "\n" +\ HOMEPAGE + "\n\n" +\ - "Usage: tsshbatch.py [-NSTehkvxy -G 'file dest' -P 'file dest' -f cmdfile -n name -p pw ] -H 'host ..' | hostlistfile [command arg ... ]\n" +\ + "Usage: tsshbatch.py [-NSTaehkvxy -G 'file dest' -P 'file dest' -f cmdfile -n name -p pw ] -H 'host ..' | hostlistfile [command arg ... ]\n" +\ " where,\n" +\ "\n" +\ " -K Force password prompting - Overrides previous -k\n" +\ @@ -98,6 +98,7 @@ " -P 'file dest' PUT local file to host dest directory\n" +\ " -S Force prompting for sudo password\n" +\ " -T seconds Timeout for ssh connection attempts\n" +\ + " -a Don't abort program after failed file transfers." +\ " -e Don't report remote host stderr output\n" +\ " -f cmdfile Read commands from file\n" +\ " -h Display help\n" +\ @@ -170,6 +171,7 @@ # Options That Can Be Overriden By User #### +ABORTONFXERROR = True # Abort after a file transfer error GETSUDOPW = False # Prompt for sudo password Hosts = [] # List of hosts to target KEYEXCHANGE = False # Do key exchange-based auth? @@ -178,7 +180,7 @@ PWORD = "" # Password REPORTERR = True # Report stderr output from remote host TESTMODE = True # Run program in test mode, don't actually execute commands -TIMEOUT = 10 # Connection attempt timeout (sec) +TIMEOUT = 15 # Connection attempt timeout (sec) UNAME = "" # Login name @@ -232,7 +234,9 @@ def ErrorExit(msg): - PrintStderr(msg) + if msg: + PrintStderr(msg) + os._exit(1) # End Of 'ErrorExit()' @@ -301,6 +305,10 @@ except: pass + # Do we continue or not? + if ABORTONFXERROR: + ErrorExit("") + # End of 'HostFileTransfer()' @@ -604,6 +612,9 @@ except: ErrorExit(eBADTIMEOUT) + if opt == "-a": + ABORTONFXERROR = False + if opt == "-e": REPORTERR = False