Page 1 of 1

is $ISUSER available in server routines?

Posted: Wed Aug 03, 2011 12:19 pm
by mctny
Hi,

I was wondering if I can use the $ISUSER environment variable ( either directly or via a function) in a server routine to get the user who execute the job? I am calling the routine from a user variables activity stage within a job sequencer.

Thanks,
Chad

Posted: Thu Aug 04, 2011 12:16 am
by ray.wurlod
Sure can. But you have to invoke a command, through DSExecute. You may as well use an operating system shell command (echo) in that case.

Code: Select all

Call DSExecute("SH", "echo $ISUSER", Output, ExitStatus)
Ans = Output<1>

Posted: Thu Aug 04, 2011 11:17 am
by mctny
Thanks a lot Ray. That works.

----------
thank you,
Chad

Posted: Mon Aug 15, 2011 1:40 pm
by mctny
I am reopening this because I came across a small issue during a special case.

When someone runs the job $ISUSER thing work but if the job is scheduled then $ISUSER is not available.

I actually looked at the second log entries of the same job in director, one is when the job is run by any user and the other one is when I schedule the job through a crontab wrapper script. in the later case there was no $ISUSER entry.

any ideas as what to do to get the username when the job is scheduled?