Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

To get output from Unix shell

SOLVED
Go to solution
Highlighted
Leep
Regular Collector

To get output from Unix shell

Hi!
I can call a Unix command (or shell scripts) from SD, but how can I get the output back to a field in SD? What is the best / easiest solution? Has any one done this before?

Regards,
Leep
7 REPLIES
Ruth Porter
Honored Contributor

Re: To get output from Unix shell

Hi there,

The only way I know of doing this is to use sd_event (in 4.5) or OvObsLoadObject.bat (in 5.0) to update the SD record with the information.

If you need help with using sd_event, just ask.

Hope this helps

Ruth
http://www.teamultra.net
Leep
Regular Collector

Re: To get output from Unix shell

Hi, Ruth!
Many many thanks for your quick reply. Have you a Unix script example that uses sd_event? If so, I can have some ideas, :-)

Regards,
Leep
Ruth Porter
Honored Contributor
Solution

Re: To get output from Unix shell

Hi there,

I have not used sd_event with Unix but the principle will be the same as for Windows.

1. Set up an import mapping for the item type and field you want to update. You must specify one field to be the unique key. For example, in a SC, ID might be unique key and if Field1 was the one you want to update, your mapping might be ID for ID (unique key) and FIELD1 for field1.

2. Set up a config file which specifies the server, port, user/password, mapping, class, log file etc.

3. Then issue the command:

sd_event -f config_file -v ID=nnn "FIELD1=$UNIX_VALUE"

sd_event is documented in chap 5 of the data exchange manual and there are examples of a config file in there.

Hope this helps

Ruth
http://www.teamultra.net

Re: To get output from Unix shell

Hi,
i attached a unix script shell using sd_event. it was used to integrate PVCS system with ServiceDesk.

hope this help

bye bye,
Simone
Leep
Regular Collector

Re: To get output from Unix shell

Hi, Simone and Ruth!
Many thanks for your very quick replies. I have got an idea how to move further.

If I develope this idea little bit further:
sd_event can only send data into SD. But if I want to get some value out, it can't. Is there such a way? For example, sd_event has created a new Call in SD, then I want to get ID out of SD.

Regards,
Leep
Ruth Porter
Honored Contributor

Re: To get output from Unix shell

Hi Leep,

You can use a DB rule to execute a command to put the value of ID somewhere you could use it - e.g. in a file, or send down a pipe, or as an argument to some script you have; it is a while since I used Unix scripting so there may be other ways,

Hope this helps

Ruth
http://www.teamultra.net
Robert S. Falko
Honored Contributor

Re: To get output from Unix shell

Leep,

It seems to me that there are at least two more possibilities:

1) OVSD can read environmental variables ( %ENV_VAR% ). If your script can set and export a variable, OVSD can read it.

2) Use the action Data Update from External System within a DB rule.

-Josh
//Add this to "OnDomLoad" event