Appreciations accepted

Vladlen Litvinov, the author: If you have some job offer for me, I'm ready to discuss it. View Vladlen Litvinov's profile on LinkedIn

Password

Friday, January 18, 2013

How to backup all your IBM BPM Process Applications?

As we know, "all sysadmins are divided into those who make backups and those who ALREADY make".

Recently I have been an eyewitness of an accident what reminded me this phrase. 12 of BPM servers were lost in one moment.

By the way, versions of BPM 7.5 and later permit to export snapshots of Process Applications using WAS wsadmin commands.


I made the small Linux shell script what exports all your snapshots from Process Center.
The script don't depend on DB platform and was tested on BPM 7.5.1 and 8.0.1

There are some limitations in BPM:
1. You cannot export archived snapshot.
2. You cannot export Tip (if it is not one).
3. You can backup BPM PA snapshots only (BPMN).

May be, my script is "Indian Coding Style" :) but it works and you can use it for your work.
Who can, let's will make it better.

#!/bin/bash
# description: backup All BPM PApps
#
# Usage:   ./exportPA.sh <BPM_ProfileFolderPath> <BPM_host> <SOAPPort> <Username> <Password> <BackupFolderPath>
#
# Example: ./exportPA.sh /opt/IBM/BPM8/profiles/ProcCtr01 localhost 8880 admin admin /opt/backup
#
# Vladlen Litvinov (c)2013
#


TODAY=`date +%Y%m%d`
# Read Information about PApps using wsadmin
"$1"/bin/wsadmin.sh -conntype SOAP -port "$3" -host "$2" -user "$4" -password "$5" -lang jython -c "print AdminTask.BPMListProcessApplications('[]')" > "$6"/PAPP$TODAY.log
    
# Reading Names of PApps to Array ARRAY
declare -a ARRAY
exec 10<"$6"/PAPP$TODAY.log
let count=0
while read LINE <&10; do
if [ -n "$LINE" ]
then
    if [[ ${LINE:0:7} = 'Acronym' ]]
 then
 ARRAY[$count]=${LINE:9}
 ((count++))
    fi
fi
done
exec 10>&-

# Reading Information about Snapshots in the PApps List
COUNT=${#ARRAY[@]}
    declare -a ARRAYSN

for (( i=0;i<$COUNT;i++)); do
    PANAME=${ARRAY[${i}]}

# Reading Information about Snapshots using wsadmin
    "$1"/bin/wsadmin.sh -conntype SOAP -port "$3" -host "$2" -user "$4" -password "$5" -lang jython -c "print AdminTask.BPMShowProcessApplication('[-containerAcronym $PANAME]')" > ""$6/$PANAME$TODAY.log
   
    unset ARRAYSN
    exec 11<"$6"/$PANAME$TODAY.log
    let count=0
    while read LINE <&11; do

 #Parsing of the file with information about Snaphots
 case "${LINE:0:7}" in
     'Acronym' ) ARRAYSN[$count]=${LINE:9}
   ((count ++));;
     'Track A' ) ARRAYSN[$count]="Track:"${LINE:15}
   ((count ++));;
     'State: ' ) temp=${LINE:12}
   #Changing places of Status and SnapshotName   

   ARRAYSN[$count]=${ARRAYSN[$count-1]}
   ARRAYSN[$count-1]=$temp
   ((count ++));;
     'Tip:'    ) ARRAYSN[$count]=${LINE:0:3}
   ((count ++));;
 esac
    done

#--ARRAYSN Example: HSS Track:Main [Inactive] Tip [Inactive] SN01
 #Parsing of the Array with information about Snapshots (no redundancy)
 COUNTSN=${#ARRAYSN[@]}
 flag=0
 for (( j=1;j<$COUNTSN;j++)); do
     temp=${ARRAYSN[${j}]}
    
         case ${temp:0:6} in
      'Track:' ) TRNAME=${temp:6}
          SNNAME='';;
      '[Undep' ) SNNAME='';;
      '[Archi' ) SNNAME=''
          flag=1;;
      '[Inact' ) SNNAME='';;
      '[Activ' ) SNNAME='';;
      'Tip'    )
      if [ $COUNTSN -gt 3 ]
   then SNNAME=''
   else SNNAME='Tip'
      fi;;
      *        )
          if [ $flag = 0 ]
    then SNNAME=$temp
    else SNNAME=''
    flag=0
          fi;;
  esac

 if [ -n "$SNNAME" ]
 then
     #Exporting Snapshots using wsadmin
         "$1"/bin/wsadmin.sh -conntype SOAP -port "$3" -host "$2" -user "$4" -password "$5" -lang jython -c "AdminTask.BPMExport('[-containerAcronym $PANAME -containerSnapshotAcronym $SNNAME -containerTrackAcronym $TRNAME -outputFile "$6"/$PANAME-$SNNAME-$TRNAME-$TODAY.twx]')" >> "$6"/export$TODAY.log
 fi

 done
    exec 11>&-
done


The result:



7 comments:

  1. great blog, great posts. but you are a bit harsh on the Vendor ;)
    care to exchange blog links on blogroll ? I run mine under middlewarehints.blogspot.com
    radek ,pl

    ReplyDelete
  2. do you have some scripts for fast start up and shut down with user and pass for dmgr and node for 3 clusters?

    ReplyDelete

  3. Tell you the truth, I have not.
    But I don't see any problem here.
    Something like this (just add several node agents and so on):
    #!/bin/sh
    # chkconfig: 2345 99 10
    # description: Run BPM

    case "$1" in
    start)
    /opt/IBM/BPM8/profiles/Dmgr01/bin/startManager.sh
    /opt/IBM/BPM8/profiles/PServer1/bin/startNode.sh
    /opt/IBM/BPM8/profiles/Dmgr01/bin/wsadmin.sh -connType SOAP -host bcvm279 -port 8884 -user admin -password admin -lang jython -c "AdminTask.startDeploymentEnv('[-topologyName BPMAPS]')"

    ;;
    stop)
    /opt/IBM/BPM8/profiles/Dmgr01/bin/wsadmin.sh -connType SOAP -host bcvm279 -port 8884 -user admin -password admin -lang jython -c "AdminTask.stopDeploymentEnv('[-topologyName BPMAPS]')"
    /opt/IBM/BPM8/profiles/PServer1/bin/stopNode.sh -user admin -password admin
    /opt/IBM/BPM8/profiles/Dmgr01/bin/stopManager.sh -user admin -password admin
    ;;
    restart)
    $0 stop
    sleep 5
    $0 start
    ;;
    *)
    echo $"Usage: $0 {start|stop|restart}"
    exit 1

    esac

    exit $script_result

    You can add some checkings also..

    ReplyDelete
  4. the script is great!. just to clarify that you must use AppTarget SOAP port (8885 in my case) and the profile that contains it.

    ReplyDelete
  5. Can we create Snapshot of the BPM PA using script ?

    ReplyDelete
    Replies
    1. Unfortunately it is not trivial. I tried to explore this but no success.

      Delete