1846593 Members
1187 Online
110256 Solutions
New Discussion

script problem

 
malay boy
Trusted Contributor

script problem

Hi,
We have a clearcase running in our server.Normally to see a file in clearcase you need to do a cleartool setview.

Here are my script :

export PATH=$PATH:/usr/atria/bin
cleartool setview ship2 &
ls /vobs/nb_delivery/

but the problem is "ls /vobs/nb_delivery" shows nothing.

Executing the "cleartool setview ship2" in shell without script will succesfully mount the /vobs/nb_delivery and "ls /vobs/nb_delivery" will show an output.But when execute is script it shows nothing.

regards
mB
There are three person in my team-Me ,myself and I.
9 REPLIES 9
Kent Ostby
Honored Contributor

Re: script problem

Perhaps its timing ...

Since you are running the "cleartool" part in the background, perhaps it doesnt complete before the ls starts.

Take out the "&" and see what happens.

Best regards,

Kent M. Ostby
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
V.Tamilvanan
Honored Contributor

Re: script problem

Hi,
As the cleartool command runs in background it might have not completed fully before executing ls.
So try removing &.
malay boy
Trusted Contributor

Re: script problem

Thanks.
Done that before but the result still the same.

regards
mB
There are three person in my team-Me ,myself and I.
Karthik S S
Honored Contributor

Re: script problem

I think your script runs in a different shell and exits. Instead run like this,

. ./script

-Karthik S S
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
Jeroen Peereboom
Honored Contributor

Re: script problem

mB,

I do not know clearcase / cleartool. What do you mean:
"Normally to see a file in clearcase you need to do a cleartool setview"

Do you mean the ls command is a cleartool command? If so, you need something like
cleartool setview ship2 << ENDHERE
ls ...
exit (?)
ENDHERE

Or is the cleartool command supposed to create a file or directory?

JP.
Robert Binkhorst
Trusted Contributor

Re: script problem

Hi,

If I remember correctly the latest clearcase versions are installed in /opt/ccase. In your current shell, what does a `which cleartool` tell you?

Anyway, it must be environment settings mixing things up for you, so you can try to add the next line to your script:
env > /tmp/env.file

And compare it to a env from your current shell. Maybe you set ccase env settings that aren't passed to children???

HTH,

Robert
linux: the choice of a GNU generation
curt larson_1
Honored Contributor

Re: script problem

the cleartool setview behaves like the newgrp command does, it forks a new process and execs a new shell.

so your cleartool setview ship2 &
is actual a seperate shell from where your doing the ls /vobs/nb_delivery/

so your setview isn't occuring the shell your doing the ls.

now to get the listing i think there is a -e option for running a command, something like:
cleartool setview ship2 -e "ls /vobs/nb_delivery"

another way is to start the view,
cleartool setview ship2 & will do that, but I think there is a better command to use for this. then look at the view through the /view directory. ls /view/ship2/vobs/nb_delivery

it has been a while since i've worked with clearcase, so i'm not really specific.
Peter Nikitka
Honored Contributor

Re: script problem

Hi mB,

Curt was right with his remark about the new
subprocess created by 'cleartool setview'.

The correct command line syntax is
cleartool setview -exe 'cmd...' viewtag
to execute a single cmd in a view so
cleartool setview -exe 'ls /vobs/nb_delivery' ship2

will do it.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
malay boy
Trusted Contributor

Re: script problem

Thanks everybody.The reply gave me same idea.Anyway I managed to solve the issue .Here are my script to copy a file from clearcase :



/usr/atria/bin/cleartool << ENDTEST
setview ship2
!ls -l /vobs/nb_delivery/current/* > /tmp/telcel.old
!rm -rf /home/bscs_fam/telcel/*
!cp /vobs/nb_delivery/current/* /CCdisk/bscs_fam/telcel
!chmod 777 /CCdisk/bscs_fam/telcel/*
ENDTEST

regards
mB
There are three person in my team-Me ,myself and I.