<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Request for splunk upgrade shell script for Linux/Unix in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478802#M82186</link>
    <description>&lt;P&gt;Hi Team, Currently I am working on a UF Auto installation script where the script has to automatically upgrade the UF package on all Linux boxes (that have v6.5.3) running to v7.3.4 using this script.&lt;/P&gt;

&lt;P&gt;The script should work as below:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Check for any existing Splunk UF version on the Linux box, if it has UF v6.5.3 is already running then, stop the UF agent, upgrade the Splunk UF package - v7.3.4 (Untar the splunkforwarder.tgz) package and then start the Splunk services.&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Post that it should connect to a DS (updating deploymentclient.conf) with DS and 8090 port details.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;If the Linux box doesn't have any Splunk UF package installed then, the script should freshly install the UF v7.3.4 package on that Linux server and then connect to DS&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Wanted to check if you have any reference shell script for the above upgrade/installation. Please note I will just use that script for reference purpose only and I won't use it directly as I don't have much details on shell scripting syntax. Request your help on this.&lt;BR /&gt;
regards, Santosh&lt;/P&gt;</description>
    <pubDate>Tue, 25 Feb 2020 06:27:50 GMT</pubDate>
    <dc:creator>santosh_scb</dc:creator>
    <dc:date>2020-02-25T06:27:50Z</dc:date>
    <item>
      <title>Request for splunk upgrade shell script for Linux/Unix</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478802#M82186</link>
      <description>&lt;P&gt;Hi Team, Currently I am working on a UF Auto installation script where the script has to automatically upgrade the UF package on all Linux boxes (that have v6.5.3) running to v7.3.4 using this script.&lt;/P&gt;

&lt;P&gt;The script should work as below:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Check for any existing Splunk UF version on the Linux box, if it has UF v6.5.3 is already running then, stop the UF agent, upgrade the Splunk UF package - v7.3.4 (Untar the splunkforwarder.tgz) package and then start the Splunk services.&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Post that it should connect to a DS (updating deploymentclient.conf) with DS and 8090 port details.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;If the Linux box doesn't have any Splunk UF package installed then, the script should freshly install the UF v7.3.4 package on that Linux server and then connect to DS&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Wanted to check if you have any reference shell script for the above upgrade/installation. Please note I will just use that script for reference purpose only and I won't use it directly as I don't have much details on shell scripting syntax. Request your help on this.&lt;BR /&gt;
regards, Santosh&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 06:27:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478802#M82186</guid>
      <dc:creator>santosh_scb</dc:creator>
      <dc:date>2020-02-25T06:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: Request for splunk upgrade shell script for Linux/Unix</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478803#M82187</link>
      <description>&lt;P&gt;Here are some bits I have borrowed from some of my scripts.&lt;/P&gt;

&lt;P&gt;Just note that you would need to change the paths (and the regex manifest check) for splunk forwarder &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SPLUNK_HOME=/opt/splunk 
deploymentserver=your.deployment.server
dsport=8089

manifest=$(ls $SPLUNK_HOME/*-manifest 2&amp;gt; /dev/null)     
if [ -z ${manifest+x}  ];then
        echo "Splunk not installed - installing"
                # your install process
                # whatever
                # $SPLUNK_HOME/bin/splunk start --accept-license
        elif [[ $manifest =~ splunk-7\.3\.4 ]]; then
                echo "7.3.4 Is Already Installed"
                # do nothing
        elif [[ $manifest =~ splunk-6\.5\.3 ]]; then
                echo "6.5.3 Is installed - upgrading"
                # your upgrade process
                # $SPLUNK_HOME/bin/splunk stop
                # whatever
                # $SPLUNK_HOME/bin/splunk start --accept-license
fi

# write a new deploymentclient.conf to system/local
echo "[deployment-client]" &amp;gt; $SPLUNK_HOME/etc/system/local/deploymentclient.conf
echo " " &amp;gt;&amp;gt; $SPLUNK_HOME/etc/system/local/deploymentclient.conf
echo "[target-broker:deploymentServer]" &amp;gt;&amp;gt; $SPLUNK_HOME/etc/system/local/deploymentclient.conf
echo "targetUri = $deploymentserver:$dsport" &amp;gt;&amp;gt; $SPLUNK_HOME/etc/system/local/deploymentclient.conf

# restart Splunk to pickup deployment client changes.
$SPLUNK_HOME/bin/splunk restart
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Feb 2020 14:32:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478803#M82187</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-25T14:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: Request for splunk upgrade shell script for Linux/Unix</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478804#M82188</link>
      <description>&lt;P&gt;Thanks for the script nick. regards, Santosh&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 09:47:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478804#M82188</guid>
      <dc:creator>santosh_scb</dc:creator>
      <dc:date>2020-02-26T09:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Request for splunk upgrade shell script for Linux/Unix</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478805#M82189</link>
      <description>&lt;P&gt;Hi Nick, thanks for the above script and that works perfectly fine on Linux servers.&lt;BR /&gt;
I have one more requirement wherein I need to write the same script in Windows Power shell. Could you share me the script if you have.&lt;BR /&gt;
regards, Santosh&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 10:45:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478805#M82189</guid>
      <dc:creator>santosh_scb</dc:creator>
      <dc:date>2020-03-02T10:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Request for splunk upgrade shell script for Linux/Unix</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478806#M82190</link>
      <description>&lt;P&gt;Hi @santosh_scb Sadly, I'm not really a windows guy (any more) &lt;BR /&gt;
I'd suggest posting a new question - like this one, but specifying that you are looking for a power shell solution.&lt;BR /&gt;
Good luck!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 11:37:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478806#M82190</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-03-02T11:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Request for splunk upgrade shell script for Linux/Unix</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478807#M82191</link>
      <description>&lt;P&gt;Hi Nick, thanks for the suggestion. &lt;/P&gt;

&lt;H2&gt;With regards to the Linux UF upgrade script that you had shared, it works fine for upgrade of UF package whereas it throws error if the UF package needs to be executed for the first time on the server. The error is as below:&lt;/H2&gt;

&lt;P&gt;root@uklvadsb0361[DEV][opt] # /tmp/test/uf_upgrade.sh&lt;BR /&gt;
ls: cannot access /opt/splunkforwarder/*-manifest: No such file or directory&lt;/P&gt;

&lt;H2&gt;Done!&lt;/H2&gt;

&lt;P&gt;The script first looks for "manifest=$(ls $SPLUNK_HOME/*-manifest) " and when doesn't find /opt/splunkforwarder it throws the error and comes out instead of executing the next line of installation of rpm package. Kindly help me on this issue. regards, Santosh  &lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 05:24:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478807#M82191</guid>
      <dc:creator>santosh_scb</dc:creator>
      <dc:date>2020-03-04T05:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Request for splunk upgrade shell script for Linux/Unix</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478808#M82192</link>
      <description>&lt;P&gt;Sorry - oversight on my part:&lt;/P&gt;

&lt;P&gt;replace this line so that it reads &lt;CODE&gt;manifest=$(ls $SPLUNK_HOME/*-manifest 2&amp;gt; /dev/null)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I have updated my answer too.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 09:12:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478808#M82192</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-03-04T09:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Request for splunk upgrade shell script for Linux/Unix</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478809#M82193</link>
      <description>&lt;P&gt;Hey nick really thanks for quick support but even with above changes, the script is not working and just comes out wihtout fresh UF install. if condition is not executed&lt;BR /&gt;
"if [ -z ${manifest+x}  ];then" &lt;/P&gt;

&lt;P&gt;Please refer the output below:&lt;/P&gt;

&lt;P&gt;root@uklvadsb0361[DEV][test] # ./uf_upgrade.sh&lt;BR /&gt;
Done! &lt;BR /&gt;
(This is the last line of the script shared below without executing the if condition)&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 10:35:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478809#M82193</guid>
      <dc:creator>santosh_scb</dc:creator>
      <dc:date>2020-03-04T10:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Request for splunk upgrade shell script for Linux/Unix</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478810#M82194</link>
      <description>&lt;P&gt;Sharing the actual script that I am using here:&lt;/P&gt;

&lt;P&gt;SPLUNK_HOME=/opt/splunkforwarder&lt;BR /&gt;
manifest=$(ls $SPLUNK_HOME/*-manifest 2&amp;gt; /dev/null)&lt;BR /&gt;
    if [ -z ${manifest+x}  ];then&lt;BR /&gt;
         echo "Splunk UF not installed - installing the UF v7.3.4 agent"&lt;BR /&gt;
         rpm -ivh splunkforwarder-7.3.4-13e97039fb65-linux-2.6-x86_64.rpm&lt;BR /&gt;
         /bin/su - splunk -c "/opt/splunkforwarder/bin/splunk start --accept-license --answer-yes --no-prompt"&lt;BR /&gt;
         echo "Generating DeploymentClient file ..."&lt;BR /&gt;
         {&lt;BR /&gt;
                echo "[deployment-client]"&lt;BR /&gt;
                echo "clientName=$HOSTNAME-dev-unixuf" &amp;gt; "$SPLUNK_HOME/etc/system/local/deploymentclient.conf"&lt;BR /&gt;
                chown -R splunk:splunk &lt;BR /&gt;
 $SPLUNK_HOME/etc/system/local/deploymentclient.conf&lt;BR /&gt;
        }&lt;BR /&gt;
        echo Done!&lt;BR /&gt;
        echo "Creating test-apps-deploy directory"&lt;BR /&gt;
        {&lt;BR /&gt;
                mkdir -p $SPLUNK_HOME/etc/apps/test-apps-deploy/local&lt;BR /&gt;
                chown -R splunk:splunk $SPLUNK_HOME/etc/apps/test-apps-deploy&lt;BR /&gt;
        }&lt;BR /&gt;
        echo Done!&lt;BR /&gt;
        echo "Generating DeploymentClient file ..."&lt;BR /&gt;
        (&lt;BR /&gt;
                echo "[deployment-client]"&lt;BR /&gt;
                echo "clientName=$HOSTNAME-dev-unixuf"&lt;BR /&gt;
                echo "[target-broker:deploymentServer]"&lt;BR /&gt;
                echo "targetUri=DSIP:8090"&lt;BR /&gt;
        ) &amp;gt; "$SPLUNK_HOME/etc/apps/test-apps-deploy/local/deploymentclient.conf"&lt;BR /&gt;
                chown -R splunk:splunk $SPLUNK_HOME/etc/apps/test-apps-deploy/local/deploymentclient.conf&lt;BR /&gt;
        echo "Restarting UF agent post installation"&lt;BR /&gt;
        /bin/su - splunk -c "/opt/splunkforwarder/bin/splunk restart "&lt;BR /&gt;
        echo Splunk UF restarted succesfully&lt;BR /&gt;
    elif [[ $manifest =~ splunkforwarder-7.3.4 ]]; then&lt;BR /&gt;
        echo "Splunk UF v7.3.4 Is Already Installed"&lt;BR /&gt;
        echo "Nothing to do!!"&lt;BR /&gt;
    elif [[ $manifest =~ splunkforwarder-6.5.3 ]]; then&lt;BR /&gt;
        echo "Already Splunk UF v6.5.3 installed, upgrading UF to Intermediatary Version 7.1.6"&lt;BR /&gt;
        rpm -U splunkforwarder-7.1.6-8f009a3f5353-linux-2.6-x86_64.rpm&lt;BR /&gt;
        echo "Upgraded to v7.1.6"&lt;BR /&gt;
        /bin/su - splunk -c "/opt/splunkforwarder/bin/splunk start --accept-license --answer-yes --no-prompt"&lt;BR /&gt;
        echo "Starting the UF"&lt;BR /&gt;
        echo "Please Wait...Splunk UF will be upgraded to Version 7.3.4"&lt;BR /&gt;
rpm -U splunkforwarder-7.3.4-13e97039fb65-linux-2.6-x86_64.rpm&lt;BR /&gt;
        echo Splunk UF upgraded to v7.3.4 succesfully!&lt;BR /&gt;
        echo Splunk UF starting now&lt;BR /&gt;
        /bin/su - splunk -c "/opt/splunkforwarder/bin/splunk start --accept-license --answer-yes --no-prompt"&lt;BR /&gt;
        echo Splunk UF started succesfully&lt;BR /&gt;
    fi&lt;BR /&gt;
echo Done!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:27:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Request-for-splunk-upgrade-shell-script-for-Linux-Unix/m-p/478810#M82194</guid>
      <dc:creator>santosh_scb</dc:creator>
      <dc:date>2020-09-30T04:27:47Z</dc:date>
    </item>
  </channel>
</rss>

