diff --git a/tsshbatch.py b/tsshbatch.py index 13d129d..3352384 100755 --- a/tsshbatch.py +++ b/tsshbatch.py @@ -20,7 +20,7 @@ CMDINCL = PROGENV + "CMDS" HOSTINCL = PROGENV + "HOSTS" -CVSID = "$Id: tsshbatch.py,v 1.206 2014/12/08 18:19:11 tundra Exp $" +CVSID = "$Id: tsshbatch.py,v 1.207 2014/12/09 15:16:12 tundra Exp $" VERSION = CVSID.split()[2] CPRT = "(c)" PROGDATE = "2011-2014" @@ -136,6 +136,7 @@ HOSTNAME = '__HOSTNAME__' HOSTNUM = '__HOSTNUM__' HOSTSHORT = '__HOSTSHORT__' +LOGINNAME = '__LOGINNAME__' TIME = '__TIME__' @@ -143,7 +144,7 @@ # variables later in order to support the user being able to redefine # them. -BuiltIns = (DATE, DATETIME, HOSTNAME, HOSTNUM, HOSTSHORT, TIME) +BuiltIns = (DATE, DATETIME, HOSTNAME, HOSTNUM, HOSTSHORT, LOGINNAME, TIME) ##### @@ -989,12 +990,19 @@ # That way, both user-defined and builtin symbols will # subsequently be substituted. + # Find out the effective name of the user doing this + + uname = UNAME + if not uname: + uname = os.getenv(USERVAR) + internals = [ (DATE, time.strftime("%Y%m%d")), (DATETIME, time.strftime("%Y%m%d%H%M%S")), (HOSTNAME, host), (HOSTNUM, str(hostnum)), (HOSTSHORT, host.split('.')[0]), + (LOGINNAME, uname), (TIME, time.strftime("%H%M%S")), ]