Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
magexposito
Active Participant
After some problems with connections from SAP Analytics Cloud to different data sources I decided to automatize the update of SAP Analytics Cloud Agent (also known as C4A Agent) as much as I can. After some test I created a semi-automatic script for Linux that download and updates the C4A Agent including stopping/starting the Apache where the agent runs. It is semi-automatic since it requires to manually write some parameters on the script for downloading the new version. In the future I would update the script so it will parse the XML file and decide if there is a new version of the agent.

The script itself is quite simple:
#!/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;
########################################################################################
# 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.

My idea for the future 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.
Labels in this area