SLES OES 2018 trustees backup script, for multiple NSS volumes (2703928)


My experience is that some customers do not have any backups of there trustee information. If you already do have an rsync. backup script in place, on your OES 2018 servers, ( see my Coolsolution URL /collaboration/oes/w/oes_tips/16522/sles-oes-2018-rsync-backup-script-for-multiple-nss-volumes )

you can add the under-mentioned trustee script on your OES 2018 servers, which will automatically make a trustees backup when your rsync backup run daily, weekly, or monthly without any human interference.

You need to achieve the steps mentioned below with the trustee backup script:

Use the rsync backup script to make data backups of multiple NSS Volumes to your destination backup server.

Use the trustee script that will make a backup of all your multiple NSS Volumes trustees.

Schedule the trustee script in remote manager (NRM) to run every hour, day, week or month to make backups of the trustees to the multiple NSS Volumes.

A mail will be sent to the recipient's email address if the trustees were backed up successfully or if it failed.

 For the backup of the trustees of the NSS Volumes use metamig as in the under-mentioned example. Metamig is a NSS File System Metadata Migration Utility. Also, see the man page for metamig.

Create the trustee script under the /sbin directory.

Here is an example of the complete trustee script :


/sbin/metamig save DATA1 > /media/nss/DATA1/trustee-bck.txt

if [ $? -eq 0 ]
mail -s "rsync backup completed successfully" < /etc/HOSTNAME
# rsync backup completed successfully @ $(date) for $(hostname)
/usr/bin/mail -s "rsync backup failed" < /etc/HOSTNAME
# rsync failed @ $(date) for $(hostname)

Save the name you want e.g.

Sections of the script is explained below:

metamig save NSSVOL > unfiltered.xml

This command exports the settings of all the files under the volume NSSVOL.

 if [ $? -eq 0 ]
A basic if statement effectively says, if a particular test is true, then perform a given set of actions. $? will contain the exit status of the last command executed.-eq 0 - string1 = string2 is true if the two strings are equal.

mail -s "rsync backup completed successfully" < /etc/HOSTNAME - /usr/bin/mail -s "rsync backup failed" < /etc/HOSTNAME
mail to recipient mail address if backup was successful or failed. You can add any detail in the title of the mail message.

Give the script executable permissions with the command - chmod x as in Figure1.




How To-Best Practice
Cool Tools
Comment List