Deployment Architecture

Scripted Input - Script calling another script

jamesvz84
Communicator

I have a scripted input, top20.sh, calling another script - top.sh.

inputs.conf

[script://./bin/top20.sh]
interval = 60
sourcetype = top
source = top
index = linux
disabled = 0

top20.sh:

#!/bin/sh
./bin/top.sh | head -n 20

I am not getting data. Running top.sh works fine. Am I assuming the correct relative path? Any other reasons why this is not returning data?

Tags (3)
0 Karma
1 Solution

jamesvz84
Communicator

The following worked on top20.sh. Not 100% sure, but I believe the modification gets the path of the calling script:

#!/bin/sh
`dirname $0`/top.sh | head -n 20

View solution in original post

jamesvz84
Communicator

The following worked on top20.sh. Not 100% sure, but I believe the modification gets the path of the calling script:

#!/bin/sh
`dirname $0`/top.sh | head -n 20

Ayn
Legend

No, the script will actually be run with the filesystem root (/) as its working directory, so you'd have to provide the full path to your other script in order to execute it successfully.

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...