If you are unable to create a new account, please email support@bspsoftware.com

 

Execute Shell in Datamanager jobstream

Started by MFGF, 21 Aug 2014 06:45:51 AM

Previous topic - Next topic

MFGF

Gary wrote in a private message:

QuoteIs there any possible way to execute shell scriptin DM job stream.

If yes, how can we do this?

Regards
Gary

Hi,

Yes, there is. You could add a Procedure Node, and in the expression, use a system() function to call whatever command you like from the command prompt.

Cheers!

MF.
Meep!

Gary

Thanks for reply.

We tried but in case the value is returned (like we are trying to see if the file is present or not or group of files with same name) it is not executing.

Yes cp,rm commands work fine. But in case we use ls to find count and then return value to implement certain logic it fails.

Gary
Gary

:)*Throw Parties Not Grenades*:)

Gary

Also, how can we execute the Shell Script rather than individual command in DS Job Stream
Gary

:)*Throw Parties Not Grenades*:)

MFGF

Quote from: Gary on 21 Aug 2014 07:21:31 AM
Thanks for reply.

We tried but in case the value is returned (like we are trying to see if the file is present or not or group of files with same name) it is not executing.

Yes cp,rm commands work fine. But in case we use ls to find count and then return value to implement certain logic it fails.

Gary

In that case, you could use the filecheck() function to test whether a specific file exists?

MF.
Meep!

Gary

We tried the same, but in this case we have to mention the exact file name. Whereas in prod system we have file name appended with file stamp.

How can this be handled dynamically. We thought for an option ti truncate the time stamp from file name but could not succeed in Procedure node as the shell command failed in procedure node where as it was executing fine in Unix prompt.
Gary

:)*Throw Parties Not Grenades*:)

MFGF

Quote from: Gary on 21 Aug 2014 07:21:31 AM
Thanks for reply.

We tried but in case the value is returned (like we are trying to see if the file is present or not or group of files with same name) it is not executing.

Yes cp,rm commands work fine. But in case we use ls to find count and then return value to implement certain logic it fails.

Gary

What exactly happens when "it fails"? Do you get an error?

Are you expecting the shell script to return some sort of result? If so, you're going to figure out how to get it to populate something Data Manager can read. Maybe it could write an entry to a specific file which Data Manager has a connection to via SQLText?

Cheers!

MF.
Meep!

Gary

We are not able to execute the shell script using system(). Once we can do it we will write the ouptut in text file as input to DM for further logic.
Gary

:)*Throw Parties Not Grenades*:)

MFGF

Quote from: Gary on 21 Aug 2014 08:17:35 AM
We are not able to execute the shell script using system(). Once we can do it we will write the ouptut in text file as input to DM for further logic.

What happens when you try to execute the shell script? Do you get an error? Is it a permissions issue?

MF.
Meep!