All Apps and Add-ons

How to run setup.sh from splunk_TA_nix on HP UX 11.31 ?,Splunk add-on setup.sh error on HP UX

ovanpeve
New Member

running:

$ splunk cmd ../etc/apps/Splunk_TA_nix/bin/setup.sh
gives:
../etc/apps/Splunk_TA_nix/bin/setup.sh[18]: Syntax error at line 18 : `(' is not expected.

How can I run it successfuly?

Thanks!,when trying to configure the TA on an universal forwarder on HP UX 11.31, I gut the followin:

splunk cmd ../etc/apps/Splunk_TA_nix/bin/setup.sh

../etc/apps/Splunk_TA_nix/bin/setup.sh[18]: Syntax error at line 18 : `(' is not expected.

Any suggestion (other than updating all shell scripts) ?

Thanks!

0 Karma

ovanpeve
New Member

ls -l /bin/sh
-r-xr-xr-x 2 bin bin 682408 Aug 26 2011 /bin/sh

There is no bash available on the system.

0 Karma

DeronJensen
Explorer

What about running a different command in that directory to test the shell. You should be able to run them directly from the CLI. I use user "splunk" and can run ps.sh:

sudo su - splunk
.../Splunk_TA_nix/bin/ps.sh
splunk cmd .../Splunk_TA_nix/bin/ps.sh

Both seem to provide the same output. You could also try running the script with a different shell, and see what that provides. I am not an expert in HP UX but it appears as though the shell provided does not like the "function" syntax. By default this TA uses /bin/sh as a shell. You could try running a different shell, but I know ksh has enough differences to cause some issues:

/bin/ksh .../Splunk_TA_nix/bin/ps.sh
/bin/csh .../Splunk_TA_nix/bin/ps.sh

(These could also be in /usr/bin/*sh)

I could be completely wrong here, but that is what it appears to be. I don't have an HP UX system to test.

0 Karma

ovanpeve
New Member

Thanks but the problem is really the syntax of the "function".
I managed to run the script by removing all the "function" keywords (and adding open/close brackets where missing) as a definition of function should be one of:

function functname{
...
}

or

functname () {
...
}
0 Karma

ovanpeve
New Member

(edit: post has been mixed)
running:
$ splunk cmd ../etc/apps/Splunk_TA_nix/bin/setup.sh
gives:
../etc/apps/Splunk_TA_nix/bin/setup.sh[18]: Syntax error at line 18 : `(' is not expected.

How can I run it successfuly?

Thanks!

0 Karma

DeronJensen
Explorer

Can you check the shell you are running:
On mine it is:

# ls -l /bin/sh
lrwxrwxrwx. 1 root root 4 Apr 24 12:47 /bin/sh -> bash

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...