itsmevic
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-bd63e13a a157-Linux -x86_64.tg z
sudo mv /tmp/cfrtl4_* /opt/splunk/etc/deployment -apps
sudo cp -avr /opt/splunk/etc/deployment -apps/cfrt l4_all_sea rch_base /opt/splunk/etc/apps
sudo cp -avr /opt/splunk/etc/deployment -apps/cfrt l4_all_for warder_out puts /opt/splunk/etc/apps
sudo cp -avr /opt/splunk/etc/deployment -apps/cfrt l4_full_li cense_serv er /opt/splunk/etc/apps
sudo cp -avr /opt/splunk/etc/deployment -apps/cfrt l4_search_ volume_ind exes /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_6 4 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-bd63e13aa 157-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/deploymen t-apps’: No such file or directory
cp: cannot stat ‘/opt/splunk/etc/deploymen t-apps/cfr tl4_all_se arch_base’ : No such file or directory
cp: cannot stat ‘/opt/splunk/etc/deploymen t-apps/cfr tl4_all_fo rwarder_ou tputs’: No such file or directory
cp: cannot stat ‘/opt/splunk/etc/deploymen t-apps/cfr tl4_full_l icense_ser ver’: No such file or directory
cp: cannot stat ‘/opt/splunk/etc/deploymen t-apps/cfr tl4_search _volume_in dexes’: 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]
[code]#!/bin/sh
cd /opt
sudo yum install -y wget
sudo adduser splunk
sudo wget -O splunk-7.3.1-bd63e13aa157-
sudo tar -xvzf /opt/splunk-7.3.1-bd63e13a
sudo mv /tmp/cfrtl4_* /opt/splunk/etc/deployment
sudo cp -avr /opt/splunk/etc/deployment
sudo cp -avr /opt/splunk/etc/deployment
sudo cp -avr /opt/splunk/etc/deployment
sudo cp -avr /opt/splunk/etc/deployment
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_6
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
100%[=====================
2019-09-20 01:02:44 (66.9 MB/s) - ‘splunk-7.3.1-bd63e13aa157
tar (child): opt/splunk-7.3.1-bd63e13aa
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/deploymen
cp: cannot stat ‘/opt/splunk/etc/deploymen
cp: cannot stat ‘/opt/splunk/etc/deploymen
cp: cannot stat ‘/opt/splunk/etc/deploymen
cp: cannot stat ‘/opt/splunk/etc/deploymen
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.