WebSphere Application Server (WAS) has a neat-o tool for backing WAS profiles, specifically backupConfig.sh, which can be executed against a profile, and which saves the entire profile configuration to a .ZIP file.
There are actually several copies of this script: -
find /opt/ibm/WebSphere/ -name backupConfig.sh
/opt/ibm/WebSphere/AppServer/bin/backupConfig.sh
/opt/ibm/WebSphere/AppServer/profiles/Dmgr02/bin/backupConfig.sh
/opt/ibm/WebSphere/AppServer/profiles/AppSrv02/bin/backupConfig.sh
/opt/ibm/WebSphere/AppServer/profiles/Dmgr01/bin/backupConfig.sh
/opt/ibm/WebSphere/AppServer/profiles/AppSrv01/bin/backupConfig.sh
/opt/ibm/WebSphere/AppServer/profiles/Dmgr02/bin/backupConfig.sh
/opt/ibm/WebSphere/AppServer/profiles/AppSrv02/bin/backupConfig.sh
/opt/ibm/WebSphere/AppServer/profiles/Dmgr01/bin/backupConfig.sh
/opt/ibm/WebSphere/AppServer/profiles/AppSrv01/bin/backupConfig.sh
*BUT* the versions that are are located within the profiles merely reference the original, which is located in the WAS bin directory: -
cat /opt/ibm/WebSphere/AppServer/profiles/Dmgr02/bin/backupConfig.sh
#!/bin/sh
binDir=`dirname ${0}`
. ${binDir}/setupCmdLine.sh
${WAS_HOME}/bin/backupConfig.sh "$@"
binDir=`dirname ${0}`
. ${binDir}/setupCmdLine.sh
${WAS_HOME}/bin/backupConfig.sh "$@"
The script has several parameters: -
/opt/ibm/WebSphere/AppServer/profiles/Dmgr02/bin/backupConfig.sh -help
Usage: backupConfig [backup_file] [-nostop] [-quiet] [-logfile <filename>]
[-replacelog] [-trace] [-username <username>] [-password <password>]
[-profileName <profile>] [-help]
[-replacelog] [-trace] [-username <username>] [-password <password>]
[-profileName <profile>] [-help]
Cleverly, *IF* one chooses to run the script from the profile root: -
/opt/ibm/WebSphere/AppServer/profiles/Dmgr02/bin/backupConfig.sh
then the script ONLY backs up that profile.
Note that there is also a -nostop option - this is NOT the default.
Therefore, if one runs this: -
/opt/ibm/WebSphere/AppServer/bin/backupConfig.sh -profileName Dmgr02
ADMU0116I: Tool information is being logged in file
/opt/ibm/WebSphere/AppServer/profiles/Dmgr02/logs/backupConfig.log
ADMU0128I: Starting tool with the Dmgr02 profile
ADMU5001I: Backing up config directory
/opt/ibm/WebSphere/AppServer/profiles/Dmgr02/config to file
/home/wasadmin/WebSphereConfig_2018-08-21_2.zip
ADMU0505I: Servers found in configuration:
ADMU0506I: Server name: dmgr
ADMU2010I: Stopping all server processes for node Dmgr
Realm/Cell Name: <default>
Username:
any JVMs running within that profile will automatically be stopped …….
Thankfully, the prompt for credentials saves us BUT it's worth remembering that this is a risk.
The other nice thing is that one can override the backup file path/name to, for example, include a date stamp: -
echo "$(date +"%Y%m%d_%H%M%S")"
20180821_123458
as follows: -
/opt/ibm/WebSphere/AppServer/bin/backupConfig.sh "/home/wasadmin/Dmgr01_Backup_$(date +"%Y%m%d_%H%M%S").zip" -profileName Dmgr01 -nostop
ADMU0116I: Tool information is being logged in file
/opt/ibm/WebSphere/AppServer/profiles/Dmgr01/logs/backupConfig.log
ADMU0128I: Starting tool with the Dmgr01 profile
ADMU5001I: Backing up config directory
/opt/ibm/WebSphere/AppServer/profiles/Dmgr01/config to file
/home/wasadmin/Dmgr01_Backup_20180821_123603.zip
.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
ADMU5002I: 1,879 files successfully backed up
/opt/ibm/WebSphere/AppServer/profiles/Dmgr01/logs/backupConfig.log
ADMU0128I: Starting tool with the Dmgr01 profile
ADMU5001I: Backing up config directory
/opt/ibm/WebSphere/AppServer/profiles/Dmgr01/config to file
/home/wasadmin/Dmgr01_Backup_20180821_123603.zip
.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
ADMU5002I: 1,879 files successfully backed up
ls -alh /home/wasadmin/Dmgr01_Backup_20180821_123603.zip
-rw-r--r-- 1 wasadmin wasadmins 551M Aug 21 12:36 /home/wasadmin/Dmgr01_Backup_20180821_123603.zip
This would be useful if, for example, one wished to create regular backups, perhaps via cron, without stopping the JVMs i.e. using the -nostop option.
No comments:
Post a Comment