Shell

SAP BOC: Semi-automatic update of C4A Agent

Update 26.07.2017: SAP BOC is no longer the name of the product and SAP changed it to SAP Analytics Cloud. I changed any references to SAP BusinessObjects Cloud within the text and future posts will have the title changed. Sorry for the inconveniences!

I am back! After some weeks of holidays and relax  I’m back to work and ready to write some new articles. There are some topics that I would like to write about but first something you were waiting for if you work with SAP Analytics Cloud. In this article I wrote about connecting SAP Analytics Cloud to different data sources. In some cases we need the SAP Analytics Cloud Agent (also known as C4A Agent)  which needs to be updated regularly. This is a pain in the ass because SAP doesn’t send you a notice about when to update the agent so usually the connections stop working.

I created a small script to semi-automatically update the agent on Linux OS. It is the first version but in the future I would like to do a completely automatic script with Python.

No more manual download

Actually the script itself is quite simple as you can see:

#!/bin/sh 
########################################################################################
#                                                                                      #
#                                BASIC DATA NEEDED                                     #
#                                                                                      #
########################################################################################
#                               OSS USER & PASSWORD                                    #
########################################################################################
OSS_User=S000XXXXXX
OSS_Pass=Password
########################################################################################
#                            C4A AGENT VERSION TO DOWNLOAD                             #
########################################################################################
Item_ID=002007974700001047632017D
Item_Name=C4AAGENT67_0-80000881.ZIP
########################################################################################
#                               APACHE ROOT DIRECTORY                                  #
########################################################################################
Apache_Root=/usr/sap/apache
wget --user $OSS_User --password $OSS_Pass --no-check-certificate --max-redirect=1 https://smpdl.sap-ag.de/~swdc/$Item_ID/$Item_Name;
mkdir ./tmp;
mv $Item_Name ./tmp;
unzip ./tmp/$Item_Name -d ./tmp;
cp ./tmp/C4A_AGENT.war $Apache_Root/webapps;
########################################################################################
#                               INSERT YOUR APACHE STOP METHOD                         #
/usr/sap/apache/parar_apache.sh &>/dev/null;
########################################################################################
rm -R $Apache_Root/webapps/C4A_AGENT;
rm -R $Apache_Root/work/Catalina/localhost/*;
########################################################################################
#                               INSERT YOUR APACHE START METHOD                        #
/usr/sap/apache/inicio_apache.sh &>/dev/null;
########################################################################################
rm -R ./tmp;
echo 'C4A AGENT UPDATED!'

Important stuff in the script:

  • OSS USER & PASSWORD: Write your user and password for the log into the Support Portal.
  • C4A AGENT VERSION TO DOWNLOAD: This is why the script is semi-automatic. You have to log here and get some data for the new agent’s version. The interesting part is the Fastkey and Title fields, write the Fastkey in the Item_ID variable and the Title in the Item_Name variable.
Needed information from SAP Support Portal
  • APACHE ROOT DIRECTORY: Write your apache directory in the variable Apache_Root.
  • INSERT YOUR APACHE STOP/START METHOD: I have a script for starting and stopping the Apache but this may vary in your different. If you start and stop the Apache via service you should use ‘service apache2 start/stop’ or ‘service httpd start/stop’, otherwise write your methods there.

Execute the script with the user you use in Apache and it should be enough. After a couple of minutes the script will download the new version, unzip it and start/stop the Apache. If everything went fine you should see the C4A_AGENT directory updated in the webapps directory of Apache.

What the future holds

The idea is to do a fully automatic script with Python so I can parse the XML from the Support Portal, check if there is a newer version and download/update it. Scheduling the script on a cron should be enough so there won’t require any human interaction during the whole process. As soon as I have the new version I will do a new post explaining the code and how to use it.

Mike

Share
Published by
Mike

Recent Posts

DevOps, Infrastructure as Code and SAP

I hope you all survived the log4j Apocalypse and Christmas, hopefully you had a great…

2 years ago

Log4Shell Critical vulnerability

I know it is being a while since I posted the last time. So far…

2 years ago

Adobe Acrobat Reader Security Update causing issues with SAPGUI

UPDATE 11/25/2020 Adobe released a new patch that solves the issue a few days ago:…

3 years ago

SAP GUI 7.70 Preview: They will know me as Quartz

Good news for you fanatics of SAP GUI! SAP will release SAP GUI 7.70 in…

4 years ago

Preparing the SAP Cloud Consultant Interview

Quick update since I don't have a lot of time lately. During my 2019 job…

4 years ago

It's the final countdown (2019 Edition)

It's been a while since the last time I wrote an entry in my blog.…

4 years ago