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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
#!/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.
- 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.