Getting Data In

Is it Possible to Configure a cronjob with Scripted Input

JoshuaJJ
Path Finder

Hello, 

I have a bash script that basically creates a cronjob. Not sure if this is allowed or not but I am able to execute it just fine when logged into the splunkfwd account on the UF. However, when ExecProc tries to execute it gives me a permission denied.  (The below app is deployed via a Deployment Server)

Sample Script (something simple, trying to get it to work first before i build in my if/then statements) 

#!/bin/bash

# List the current user's crontab and save output to /tmp/cron_out
echo "* * * * * testing_this_out" | crontab - > /tmp/cron_out 2>&1

 

inputs.conf 

[script://./bin/install_cron.sh]
disabled = false
interval = 10   
sourcetype = cron_upgrader
index = splunk_upgrade

 

App Structure 

/opt/splunkforwarder/etc/apps/<app_name>/

...........bin > install_cron.sh 

...........local > inputs.conf  

Not sure, but I am pretty sure Splunk restricts what can be executed since if I manually execute the script, it works fine. 

Labels (2)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

If something "should work" but gives permission denied, the first culprit to check is SELinux 🙂

0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @JoshuaJJ 

Make sure that the file has execute chmod settings so that it can be executed without prepending with "bash" (for example)

chmod +x <yourSHFile)

Please let me know how you get on and consider adding karma to this or any other answer if it has helped.
Regards

Will

0 Karma

JoshuaJJ
Path Finder

Good morning, thanks for your reply! File already has execute

0 Karma

livehybrid
SplunkTrust
SplunkTrust

Thats odd @JoshuaJJ  - Please can you post the logs that ExecProcessor spits out so I can try and replicate this?

Thanks

0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...