sudo comand with ControlM


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users sudo comand with ControlM
# 1  
Old 04-18-2006
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
# 2  
Old 04-18-2006
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
# 3  
Old 04-18-2006
Thanks, I give this a try!

Mark
# 4  
Old 04-30-2006
Quote:
Originally Posted by u156531
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
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Exit1 not to report failure in controlM

HI Team, I running below script from controlM and job is reporting as failure everyday so i tried to change the if exitstatus=1 (send only email) but not to end as a job is failed. can you let me know where i have to change this script to make the script not to fail but instead send email and... (3 Replies)
Discussion started by: Mi4304
3 Replies

2. Shell Programming and Scripting

UNIX comand

Team, I need unix command to grep directory part from the string for example I have a texts something like /apps/opt/data/current/spool/test.dbf /apps/opt/archive/../../test.dbf I need only directory part from that string like my out put will /apps/opt/data/current/spool/... (1 Reply)
Discussion started by: asappidi
1 Replies

3. Shell Programming and Scripting

ssh foo.com sudo command - Prompts for sudo password as visible text. Help?

I am writing a BASH script to update a webserver and then restart Apache. It looks basically like this: #!/bin/bash rsync /path/on/local/machine/ foo.com:path/on/remote/machine/ ssh foo.com sudo /etc/init.d/apache2 reloadrsync and ssh don't prompt for a password, because I have DSA encryption... (9 Replies)
Discussion started by: fluoborate
9 Replies

4. AIX

smit see comand performed ??

i in smit , press F6 , smit fs , Change / Show Characteristics of an Enhanced Journaled File System then F6 to see the comand , how can i see the command performed ?? x() { │ │ LIST= ... (5 Replies)
Discussion started by: prpkrk
5 Replies

5. Solaris

Using dd comand

Hello peolple i have to check a tape with de dd comand and redirect the exit dd if=/dev/rmt/0cn ibs=1024k of=/dev/null i need that the exit from that commando go to a log if a do this dd if=/dev/rmt/0cn ibs=1024k of=/dev/null > x.log don`t send me nothing to the log only in the screen. I need... (1 Reply)
Discussion started by: enkei17
1 Replies

6. UNIX for Dummies Questions & Answers

Identify File with ControlM Characters

Dear Members, I have a file which contains ControlM characters in it. I need a command by the means of which i should be able to identify if a file has controlM characters. How can this be achieved. Thanks Sandeep (4 Replies)
Discussion started by: sandeep_1105
4 Replies

7. Solaris

comand df -k

I need to know the available space in my unix. when making a df -k it shows me the following thing: /dev/vx/dsk/emc2/vol06 136764867 121542767 1545614 99% /emc06 would need them to explain to me well the command. since under the column avail the resulting value is... (2 Replies)
Discussion started by: roviedo
2 Replies

8. Shell Programming and Scripting

Testing a comand in the script

Hi everyone , i am new to shell scripting and am having some problem to test if this line has been executed well and display a pass message on the screen or fail if not sqlplus XXTEST/$2 <<END > $XXTEST_TOP/log/$0.log @$XXTEST_TOP/admin/sql/XXTEST_SPE1_XX_QUOTE_DETAILS_TBL.sql XXTEST$2... (2 Replies)
Discussion started by: Lutchumaya
2 Replies

9. UNIX for Dummies Questions & Answers

exec comand

hi, i have written a small script in which i use exec command and redriect output to a file..after sometime i want to switch it off and redirect the output to screen..how to do it exec >> /tmp/out.txt 2>&1 //set of statements then i want to switch of these exec as the rest should get... (5 Replies)
Discussion started by: mkan
5 Replies

10. UNIX for Dummies Questions & Answers

mount comand

Dear experts: I am installing software on Unix via telnet using CD on my NT workstation. What kind of NFS & mount comands I should run in the beginning ? (what exactly should be <drive for cdrom> and <mount ditectory> in the mount comand? Thanks in advance, etc.. (6 Replies)
Discussion started by: lostam
6 Replies
Login or Register to Ask a Question