By Rusty Howell
cleanup_zos.sh is an automated script to uninstall, clean, delete any remains of the ZOS server used for testing purposes. cleanup.sh works with ZOS 1.2 and 1.3. This allows the tester or engineer to quickly clean and remove any trace of the ZOS server package or related packages. It also allows the user to restore keys from an old server.
It is designed to work on Linux systems and is written in bash. cleanup_zos.sh uses Novell Zenworks Linux Management tool (zmd). SLES 10, SLED, and OES have zmd installed on their systems. For other distro’s, manually removing ZOS components is necessary.
Usage: cleanup_zos.sh [OPTIONS]
-a Deletes All ZOS packages, CIM instances, directories. same as -scypbd
-b Delete audit database (you must edit cleanup_zos.sh to edit database attributes)
-c Deletes CIM instances
-d Deletes all Directories
-h This help message
-i [pattern] Installs a YaST pattern
-p Removes rpms
-r Restore TLS certificates
-s Save TLS certificates (default)
-x Shutdown, Destroy and Delete all XEN instances
-y Removes YaST patterns
Delete audit database: ( -b option)
In ZOS 1.2, the MySQL DB is the database used for the Audit DB.
In ZOS 1.3, the default DB used for the Audit DB is Postgres.
cleanup.sh can work with either of these databases, but you have to edit cleanup_zos.sh to give the correct values of the audit database.
In case MySQL/Postgres cannot cleanup automatically when the cleanup_zos.sh is called it will ask for the database data interactively to the user and try again.
Fields that need to be edited:
database=POSTGRESQL # Possible values: MYSQL, POSTGRESQL
adminuser=postgres # MySQL Admin: root, PostgreSQL Admin: postgres
zosdb=zos_db # Default to database name given by the ZOS installer
zosuser=zos_user # audit database user
host=localhost # host of the database
Delete CIM instances ( -c option)
Used to delete CIM instances (mainly used for XEN virtual hosts) not totally tested
Classes to clean:
Delete all Directories: ( -d option)
Used to delete all directories used by ZOS.
Directories to delete:
Help message: ( -h option)
Install a YaST pattern: ( -i option)
Help to install a pattern related to ZOS automatically:
Patterns that can be installed:
Remove rpms: ( -p option )
Help to remove all rpms related to zos.
rpms that will be removed using this option:
Restore TLS certificates: ( -r option)
Restores old TLS certificates generated by old installation of zos server, and backed up using this script when zos cleanup was performed.
Save TLS certificates: ( -s option)
Some times it is desirable to cleanup and reinstall only the ZOS server while leaving the agents running on other machines in the grid. The agents rely on the certificates to communicate with the ZOS server. If the ZOS server’s TLS certificates are changed, the agents will be unable to communicate with ZOS properly. Reinstalling the ZOS server will create a new TLS certificate on the ZOS server.
Backing up and restoring the TLS certificates of the original ZOS server is a good way to keep the zos server and agents communicated happy and running.
This options is enabled by default with the -a flag (when removing all details of zos server). Certificates are saved in /tmp/zos-certs.
Shutdown, Destroy and Delete XEN instances: ( -x option)
Useful for virtual machine host machines where they may have zos templates/clones in running mode.
This will shutdown all virtual machines machines that XEN list with xm li, and then it will destroy and deletes from xm list.
Then it will remove physically the directory/vm from /var/lib/xen/images/
Remove a YaST pattern: ( -y option)
Help to remove a YaST pattern:
Patterns that can be removed using this script:
Deletes All ZOS packages, CIM Instances, directories: ( -a option or -scypbd )
This option will go for all the options that this script has to clean zos related stuff ( except -x flag for XEN instances cleanup)