sudo comand with ControlM

I'm trying to change the user Id that the script is running under. I tried the sudo comand but the job was submitted under ControlM and it seems that controlM is not allowing the user id to change. I have included the job output below. The sudo comand was suppose to set the user id to "DWSOLAP" but when I checked the uservalue it was still set to "DWSPROD". Does any one know how to get around this problem? Thanks

export JOBNAME=PQDWSL001
+ export CCDATE=20060314
+ logdte=20060314
+ print 20060314
20060314
+ appln=dws
+ proj=dwssdm
+ sudo su - dwsolap
Set ESSLANG to English_UnitedStates.Latin1@Binary
+ + whoami
uservalue=dwsprod
+ + cut -b 4-7
+ echo dwsprod
myenv=prod
+ [[ prod = olap ]]
+ [[ prod = olad ]]
+ echo Environment not set
Environment not set
+ exit 1

This is not the best nor nicest option. I'm not even sure this is what your looking for since your running your script from control-M. I'm assuming that you need your script to run with the same permissions as the user DWSOLAP. If that is true, here is an option.

You could setuid the script.

chown DWSOLAP scriptname
chmod 4750 scriptname

This will tell the script to run as the user DWSOLAP no matter who executes it.

Good Luck!

-X

Thanks, I give this a try!

Mark

I am not certain why you are setting some of this in the script itself.

The "OWNER" of the job in the Job Scheduiling Definition within CONTROL-M will be the user that executes the script. CONTROL-M executes the "su" command in order to run this job as the user that is specified in this field.

LOGDTE is %%CALCDATE in CONTROL-M.

appln=dws
proj=dwssdm

These two are set by the "APPLCATION" and "GROUP" fields in the Job Scheduiling Definition.

All of the variables that you have set can be set in the LIBMEMSYM (flatfile for CONTROLM/Server) or the Set tab in the Job Scheduiling Definition.

RoadHard