webMethods API Portal tutorial
It is always a recommended good practice to backup your data periodically, so that you can recover your environment even incase of a data loss or a system failure. As part of this tutorial we will explore ways of automating the regular backup with webMehtods API Portal.
Backup script
#!/bin/sh
SAGInstallDir="/opt/Portal104"
backupDir="/FS/backups"
today=b"$(date +%d)_$(date +%m)"
echo "creating backup directory $backupDir/$today"
mkdir -p $backupDir/$today
cd $SAGInstallDir/API_Portal/server/acc
cmd="backup tenant default to \"$backupDir/$today\""
echo "executing command $cmd"
./acc.sh -h localhost -u Clous -pwd g3h31m -p 18010 "$cmd"
echo "sucessfully completed the backup"
Above one is a simple shell script to make use of ACC command line utiltiy to trigger a backup. We use the ACC command backup tenant to trigger the backup process. We supply the newly created backup directory as a arguement to the backup tenant command, so that the created backup will be placed in the directory given.
ACC+ localhost>help backup tenant Syntax: Examples: backup tenant softwareag username="alice" password="70ps3cr37" backup tenant softwareag to c:\temp backup tenant softwareag for UMC, ABS
|
Scheduling the script
We can make use of crontab to schedule the backup script that we created to execute periodically.
crontab
-e
add the entry -> 51 07 * * * <FileLocation>/<filename>.sh
* * * * * command to be executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)
Below cron expression schedules the backup.sh to be exeucted daily at 12:00
crontab
-l
The backup file used in this tutorial can be found here.
backup.sh (374 Bytes)