Executing a TCL command from a UNIX script.

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

Locked
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Executing a TCL command from a UNIX script.

Post by admin »

Hello All,

My problem is that we wish to control schedule jobs using Maestro from a remote machine.

Currently the only way I can see to do this is to:
Run a UNIX Script
Which uses .../Ardent/uv/bin/dsjob to run a control job which:
Evaluates parameters
Executes the Required job
Wait for the Required job to Complete
Returns Control & Status to the UNIX Script
Which it Turn Returns Status to the Remote Machine.

The problem with this Scenario is that in order to Allow more than One job to be invoked at a time it requires potentially a Control Job for every Job.

What seems to be a much better option is to run a function like RoutinessdkUtilityRunJob from the UNIX environment.

By compiling and cataloging a BP program called say ExecuteUtilityRunJob which in turn could execute UtilityRunJob we would achieve con-currency.

However when I try
exec $uvhome/bin/uv ExecuteUtilityRunJob , or
exec $uvhome/bin/uvsh ExecuteUtilityRunJob
Control is NOT returned to UNIX. What happens is the process runs but then Logs Out and disconnects the session.

One Option may be to:
Fork the exec $uvhome/bin/uvsh ExecuteUtilityRunJob (which writes a
semaphore)
Then Wait for the semaphore to appear.

But I am hoping there is a better Way, can anyone help?

Thanks In advance Jack



CAUTION: This correspondence is confidential and intended for the named recipient(s) only. If you are not the named recipient and receive this correspondence in error, you must not copy, distribute or take any action in reliance on it and you should delete it from your system and notify the sender immediately. Thank you.

Unless otherwise stated, any views or opinions expressed are solely those of the author and do not represent those of Vodafone New Zealand Limited.

Vodafone New Zealand Limited
21 Pitt Street, Private Bag 92161, Auckland, 1020, New Zealand Telephone + 64 9 357 5100 Facsimile + 64 9 377 0962
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

We do this, for UniVerse:


cd /xxx
$uvhome/bin/uvsh "PROGRAM.NAME PARAM1 PARAM2..."

Of course, we do wrap some other stuff in: test to see if UniVerse is running, check on the status of dependencies, etc. This returns to unix; when I use exec it leaves me in a UniVerse session.

-----Original Message-----
From: Jack.Luchjenbroers@vodafone.co.nz [mailto:Jack.Luchjenbroers@vodafone.co.nz]
Sent: Monday, May 14, 2001 6:26 PM
To: informix-datastage@oliver.com
Subject: Executing a TCL command from a UNIX script.



Hello All,

My problem is that we wish to control schedule jobs using Maestro from a remote machine.

Currently the only way I can see to do this is to:
Run a UNIX Script
Which uses .../Ardent/uv/bin/dsjob to run a control job which:
Evaluates parameters
Executes the Required job
Wait for the Required job to Complete
Returns Control & Status to the UNIX Script
Which it Turn Returns Status to the Remote Machine.

The problem with this Scenario is that in order to Allow more than One job to be invoked at a time it requires potentially a Control Job for every Job.

What seems to be a much better option is to run a function like RoutinessdkUtilityRunJob from the UNIX environment.

By compiling and cataloging a BP program called say ExecuteUtilityRunJob which in turn could execute UtilityRunJob we would achieve con-currency.

However when I try
exec $uvhome/bin/uv ExecuteUtilityRunJob , or
exec $uvhome/bin/uvsh ExecuteUtilityRunJob
Control is NOT returned to UNIX. What happens is the process runs but then Logs Out and disconnects the session.

One Option may be to:
Fork the exec $uvhome/bin/uvsh ExecuteUtilityRunJob (which writes a
semaphore)
Then Wait for the semaphore to appear.

But I am hoping there is a better Way, can anyone help?

Thanks In advance Jack



CAUTION: This correspondence is confidential and intended for the named
recipient(s) only. If you are not the named recipient and receive this correspondence in error, you must not copy, distribute or take any action in reliance on it and you should delete it from your system and notify the sender immediately. Thank you.

Unless otherwise stated, any views or opinions expressed are solely those of the author and do not represent those of Vodafone New Zealand Limited.

Vodafone New Zealand Limited
21 Pitt Street, Private Bag 92161, Auckland, 1020, New Zealand Telephone + 64 9 357 5100 Facsimile + 64 9 377 0962
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Jack,

The problem seems to be with exec. Read "man exec" to see that exec replaces your current UNIX shell with the executed program, in your case the UniVerse shell. So it can never return. Leaving the exec out (perhaps replace it with "." or "source") should fix the problem.

But if youre going to go to this trouble, why not make use of the fact that you can run a job directly from TCL using the DSD.RUN verb?

(For other folks on the list I know that Jack is a competent UniVerse programmer; what follows may be bewildering to some of you. NTHS is another DS site where Jack has worked.)

... so you dont need to re-invent the wheel. The job control functions such as DSGetJobInfo etc. are all catalogued locally, and their constants are declared in the header file DSINCLUDE/JOBCONTROL.H, so everything you need ought to be right there. Remotely execute your "main" controlling job (like at NTHS) and capture the results by any means you wish.

-----Original Message-----
From: Jack.Luchjenbroers@vodafone.co.nz [mailto:Jack.Luchjenbroers@vodafone.co.nz]
Sent: Tuesday, 15 May 2001 05:26
To: informix-datastage@oliver.com
Subject: Executing a TCL command from a UNIX script.



Hello All,

My problem is that we wish to control schedule jobs using Maestro from a remote machine.

Currently the only way I can see to do this is to:
Run a UNIX Script
Which uses .../Ardent/uv/bin/dsjob to run a control job which:
Evaluates parameters
Executes the Required job
Wait for the Required job to Complete
Returns Control & Status to the UNIX Script
Which it Turn Returns Status to the Remote Machine.

The problem with this Scenario is that in order to Allow more than One job to be invoked at a time it requires potentially a Control Job for every Job.

What seems to be a much better option is to run a function like RoutinessdkUtilityRunJob from the UNIX environment.

By compiling and cataloging a BP program called say ExecuteUtilityRunJob which in turn could execute UtilityRunJob we would achieve con-currency.

However when I try
exec $uvhome/bin/uv ExecuteUtilityRunJob , or
exec $uvhome/bin/uvsh ExecuteUtilityRunJob
Control is NOT returned to UNIX. What happens is the process runs but then Logs Out and disconnects the session.

One Option may be to:
Fork the exec $uvhome/bin/uvsh ExecuteUtilityRunJob (which writes a
semaphore)
Then Wait for the semaphore to appear.

But I am hoping there is a better Way, can anyone help?

Thanks In advance Jack



CAUTION: This correspondence is confidential and intended for the named
recipient(s) only. If you are not the named recipient and receive this correspondence in error, you must not copy, distribute or take any action in reliance on it and you should delete it from your system and notify the sender immediately. Thank you.

Unless otherwise stated, any views or opinions expressed are solely those of the author and do not represent those of Vodafone New Zealand Limited.

Vodafone New Zealand Limited
21 Pitt Street, Private Bag 92161, Auckland, 1020, New Zealand Telephone + 64 9 357 5100 Facsimile + 64 9 377 0962
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Ray & Dan,

Although I am not quite on top it, I can see the end. Thanks to your contributions.

My major problem is my thin Unix knowledge. But there you go it gets better every day.

Thanks Jack

----- Original Message -----
From: "Fitzgerald, Dan"
To:
Sent: Tuesday, May 15, 2001 8:18 AM
Subject: RE: Executing a TCL command from a UNIX script.


> We do this, for UniVerse:
>
>
> cd /xxx
> $uvhome/bin/uvsh "PROGRAM.NAME PARAM1 PARAM2..."
>
> Of course, we do wrap some other stuff in: test to see if UniVerse is
> running, check on the status of dependencies, etc. This returns to
> unix; when I use exec it leaves me in a UniVerse session.
>
> -----Original Message-----
> From: Jack.Luchjenbroers@vodafone.co.nz
> [mailto:Jack.Luchjenbroers@vodafone.co.nz]
> Sent: Monday, May 14, 2001 6:26 PM
> To: informix-datastage@oliver.com
> Subject: Executing a TCL command from a UNIX script.
>
>
>
> Hello All,
>
> My problem is that we wish to control schedule jobs using Maestro
> from a remote machine.
>
> Currently the only way I can see to do this is to:
> Run a UNIX Script
> Which uses .../Ardent/uv/bin/dsjob to run a control job which:
> Evaluates parameters
> Executes the Required job
> Wait for the Required job to Complete
> Returns Control & Status to the UNIX Script
> Which it Turn Returns Status to the Remote Machine.
>
> The problem with this Scenario is that in order to Allow more than One
> job to be invoked at a time it requires potentially a Control Job for
> every Job.
>
> What seems to be a much better option is to run a function like
> RoutinessdkUtilityRunJob from the UNIX environment.
>
> By compiling and cataloging a BP program called say
> ExecuteUtilityRunJob which in turn could execute UtilityRunJob we
> would achieve con-currency.
>
> However when I try
> exec $uvhome/bin/uv ExecuteUtilityRunJob , or
> exec $uvhome/bin/uvsh ExecuteUtilityRunJob
> Control is NOT returned to UNIX. What happens is the process runs but
> then Logs Out and disconnects the session.
>
> One Option may be to:
> Fork the exec $uvhome/bin/uvsh ExecuteUtilityRunJob (which writes a
> semaphore)
> Then Wait for the semaphore to appear.
>
> But I am hoping there is a better Way, can anyone help?
>
> Thanks In advance Jack
>
>
>
> CAUTION: This correspondence is confidential and intended for the
> named
> recipient(s) only. If you are not the named recipient and receive this
> correspondence in error, you must not copy, distribute or take any action
in
> reliance on it and you should delete it from your system and notify
> the sender immediately. Thank you.
>
> Unless otherwise stated, any views or opinions expressed are solely
> those
of
> the author and do not represent those of Vodafone New Zealand Limited.
>
> Vodafone New Zealand Limited
> 21 Pitt Street, Private Bag 92161, Auckland, 1020, New Zealand
> Telephone + 64 9 357 5100 Facsimile + 64 9 377 0962
>
Locked