Using backupios from cron
Technote
(FAQ)
Question
How can I run the
backupios command automatically from the crontab?
Cause
I get errors when I try to configure the crontab to run a
backupios automatically.
Answer
Many commands fail when run from cron, even though they work
when run from the padmin command line interface (CLI).
Failing commands include mount <NFS directory> and
backupios.
This is because /home/padmin/.profile is an important part of the CLI, changing the path and aliasing many commands.
The cron function does not read a user's .profile, and so the commands fail. This is working as designed.
To enable the cron to run commands in the same way as the CLI, the command should start with /usr/ios/cli/ioscli
For example:
/usr/ios/cli/ioscli mount nimserver:/export /mnt
/usr/ios/cli/ioscli backupios -file /mnt/vios_backup -mksysb
If you want to redirect the output to a file you must use the "tee" command instead of the ">"
For example:
/usr/ios/cli/ioscli backupios -file /mnt/vios_backup -mksysb | tee /home/padmin/backupioserror.log