top of page

Background:

Since r80 stopped supporting "Web Visualization Tool", we now will use "Show Package Tool" for its replacement. Now, customer requires to automate the process, so I wrote a script and set up a cronjob to handle the requirements. See sk77300

Summary:

Step 1. Write a script 

cat policy.sh 

#! /bin/bash -f

 

source /opt/CPshrd-R80.30/tmp/.CPprofile.sh

 

# Vars

POLICY=show_package-`date +"%Y-%m-%d"`_*.tar.gz

 

# Generate policy file

/bin/sh /opt/CPsuite-R80.30/fw1/scripts/web_api_show_package.sh -d [CMA's IP] -o /var/tmp/ABC

cd /var/tmp/ABC

 

# SFTP policy

export SSHPASS=XXXX ##<- sftp server's password 

sshpass -e sftp -oBatchMode=no -b - user1@[SFTP's_IP address] << !

   cd /Target_File_DIR

   put ${POLICY}

   bye

!

# Clean up policy

# rm /var/tmp/ABC/${policy}

Step 2. Set up a cronjob 

ssh to the MDS server 

crontab -u admin -e

 

#  This file was AUTOMATICALLY GENERATED

#  Generated by /bin/cron_xlate on Thu Nov 21 19:58:48 2019

#

#  DO NOT EDIT

#

SHELL=/bin/bash

MAILTO=""

#

# mins  hrs     daysinm months  daysinw command

#

0 23 * * * /home/admin/policy.sh >/dev/null 2>&1  ##<< run this job at 23 daily

Tshoot: if the web_api_show_package.sh stopped working, try to restart the API service. See sk123863

bottom of page