Link to home
Start Free TrialLog in
Avatar of itsmevic
itsmevicFlag for United States of America

asked on

Script is Choking for Some Reason

I've got a simple bash script (see below) that I am trying to run but it keeps choking on me for some reason.  It will make it as far as bringing the .tgz file down but when it try's to untar it, it will crap out.  I've checked permissions, those are fine.  

[code]#!/bin/sh

cd /opt

sudo yum install -y wget

sudo adduser splunk

sudo wget -O splunk-7.3.1-bd63e13aa157-Linux-x86_64.tgz 'https://www.splunk.com/bin/splunk/DownloadActivityServlet?architecture=x86_64&platform=linux&version=7.3.1&product=splunk&filename=splunk-7.3.1-bd63e13aa157-Linux-x86_64.tgz&wget=true'

sudo tar -xvzf /opt/splunk-7.3.1-bd63e13aa157-Linux-x86_64.tgz

sudo mv /tmp/cfrtl4_* /opt/splunk/etc/deployment-apps

sudo cp -avr /opt/splunk/etc/deployment-apps/cfrtl4_all_search_base /opt/splunk/etc/apps

sudo cp -avr /opt/splunk/etc/deployment-apps/cfrtl4_all_forwarder_outputs /opt/splunk/etc/apps

sudo cp -avr /opt/splunk/etc/deployment-apps/cfrtl4_full_license_server /opt/splunk/etc/apps

sudo cp -avr /opt/splunk/etc/deployment-apps/cfrtl4_search_volume_indexes /opt/splunk/etc/apps

sudo chown -R splunk:splunk splunk

sudo splunk/bin/splunk enable boot-start -user splunk --accept-license

sudo chown -R splunk:splunk splunk

sudo splunk/bin/splunk start/code]

Here is what the terminal shows where it is erroring out at:
[code]sudo ./cfrtl4_sh1.sh
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: repos-va.psychz.net
 * epel: iad.mirror.rackspace.com
 * extras: repos-va.psychz.net
 * updates: repos-va.psychz.net
Package wget-1.14-18.el7_6.1.x86_64 already installed and latest version
Nothing to do
adduser: user 'splunk' already exists
--2019-09-20 01:02:43--  https://www.splunk.com/bin/splunk/DownloadActivityServlet?architecture=x86_64&platform=linux&version=7.3.1&product=splunk&filename=splunk-7.3.1-bd63e13aa157-Linux-x86_64.tgz&wget=true
Resolving www.splunk.com (www.splunk.com)... 204.237.229.64, 204.237.229.74
Connecting to www.splunk.com (www.splunk.com)|204.237.229.64|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 112617 (110K) [text/html]
Saving to: ‘splunk-7.3.1-bd63e13aa157-Linux-x86_64.tgz’

100%[=======================================================================================================================================================================================================================>] 112,617     --.-K/s   in 0.002s  

2019-09-20 01:02:44 (66.9 MB/s) - ‘splunk-7.3.1-bd63e13aa157-Linux-x86_64.tgz’ saved [112617/112617]

tar (child): opt/splunk-7.3.1-bd63e13aa157-Linux-x86_64.tgz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
mv: cannot move ‘/tmp/cfrtl4_sh1.sh’ to ‘/opt/splunk/etc/deployment-apps’: No such file or directory
cp: cannot stat ‘/opt/splunk/etc/deployment-apps/cfrtl4_all_search_base’: No such file or directory
cp: cannot stat ‘/opt/splunk/etc/deployment-apps/cfrtl4_all_forwarder_outputs’: No such file or directory
cp: cannot stat ‘/opt/splunk/etc/deployment-apps/cfrtl4_full_license_server’: No such file or directory
cp: cannot stat ‘/opt/splunk/etc/deployment-apps/cfrtl4_search_volume_indexes’: No such file or directory
chown: cannot access ‘splunk’: No such file or directory
sudo: splunk/bin/splunk: command not found
chown: cannot access ‘splunk’: No such file or directory
sudo: splunk/bin/splunk: command not found/code]
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial