Snippets

litmis Practical use of `rsync` on IBM i

Created by Aaron Bartell

| | | - | - | - | - IBM i Hosting | Cybersource Toolkit for i | RPG-XML Suite | Payment Terminal Toolkit for i | UPS Toolkit for i

Practical use of rsync on IBM i

All HA products on IBM i use IFS journaling to accomplish mirroring except for PowerHA. This is a problem for directories where Git needs to be used because IFS journaling prohibits certain API calls like mmap. Never fear! IBM delivered rsync recently and it can be used to remedy this situation by way of a simple script.

Below we have the replicate.sh script. This script copies three separate Git controlled directories that have IFS journaling turned off to the /REPLICATE directory that is being IFS journaled.

$ cat /REPLICATE/replicate.sh
#!/QOpenSys/usr/bin/sh

SECONDS=0
mkdir /REPLICATE
echo "Replicating /QOpenSys/ibmichroot_spaces/git-server/repos"
rsync -a --delete /QOpenSys/ibmichroot_spaces/git-server/repos /REPLICATE

echo "Replicating /home"
rsync -a --delete /home /REPLICATE

echo "Replicating /www"
rsync -a --delete /www /REPLICATE

Implementation Details

Depending on the size of your directories and the speed of your machine the first run can take the better part of an hour. Subsequent runs, with only a few files changing, takes significantly less time (i.e. 30 seconds). This means it can be run often throughout the day (i.e. once an hour?)

Add the following to your scheduling software...

QSH CMD('/REPLICATE/replicate.sh')

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.