KB Article #177795

How to script a backup of kps collections with kpsadmin

Problem

The kpsadmin command line tool is menu driven with the ability to backup KPS collections. However it doesn't have its own shell which can be command driven for easy scripting. How can kpsadmin be used in a script to run a backup?

Resolution

Answer: As of 7.5.3 and later, kpsadmin does have scriptable commands.

Doc link, see section: "Run kpsadmin operations in scriptable command mode"


Old answer, retained for historical reasons, or in case some desired operation is not supported via current script commands:

The only way currently to run kpsadmin in a script would be to redirect stdin from a file containing the menu responses. kpsadmin should be run manually first to check the collection index numbers required in the backup.

e.g. kpsadmin is run with a file "in.txt" to backup API Manager with standard 3 collections. Note this will backup the first 3 collections of the first group and first instance in a domain. This may need to be adjusted for the target topology and KPS configuration.

cd {apigatewayhome}/posix/bin
./kpsadmin -u admin -p changeme < in.txt

======== in.txt ==========

21
1
1
1
y

41
2


21
y


41
3


21
y


q

======== in.txt ==========