1863029 Members
1060 Online
110446 Solutions
New Discussion

Re: backup script

 
I.Delic
Super Advisor

backup script

hi Guy's,

Could you help me wiht making one script.
Wat should this script do:
Ordinary backup.
I wil use fbackup tool
I want to backup evrytihing on my box (EVRYTHING)
Script should genereted a log file to see witch file's are backuped.Also script should
genered a error.log file to see what is wrong.If something is wrong i should get a mail in my mailbox
ofcourse i wil stop all application before i do backup.
This script should tel me how long it teked to make backup.
Just start time and date and on the end of the backup end time.

Thank you in advance


P.S. not too complicate i have to understnd it

OS is use is HP-UX 11.11. version 1
6 REPLIES 6
Simon Hargrave
Honored Contributor

Re: backup script

In simple terms (assuming you have a smallish server, otherwise you should really backup your filesystems separately): -

# get date for logfile names.
DATE=`date +%d%m%Y`

# save starting time/date.
START=`date`

# do the backup. the -v will generate a large log, but it includes all filenames. write to .log and .err file.
fbackup -0 -v -i / -f /dev/rmt/0mn > /somefilesystem/backup.$DATE.log 2>/somefilesystem/backup.$DATE.err

# check returncode of fbackup command
if [ $? -ne 0 ]; then
# there was an error so mail admin
cat /somefilesystem/backup.$DATE.err | mailx -s "Backup Error Log" [email protected]
fi

# append start time to logfile
echo "Started: $START" >> /somefilesystem/backup.$DATE.log

# append end time to logfile
echo "Finished: `date`" >> /somefilesystem/backup.$DATE.log


Something like that would be a start.
BONNAFOUS Jean Marc
Trusted Contributor

Re: backup script

Hi,

Try:

fbackup -I index.log -f /dev/rmt/... -i / 1>error.log 2>&1

where /dev/rmt/... is your device file, index.log is the file where all saving files are tracing. fbackup create a index on tape but this index is create BEFORE save and is not completety reliable. -I option create index on disk AFTER save (it isn't create if command fails).

For more info to fbackup command: http://docs.hp.com/fr/5187-2222/ch06s04.html#fbackup (in french, sorry I don't know URL for english doc.)

Rgds
JMB
Si vous ne faites jamais de bétises, c'est que vous ne faites rien de difficile. Et ça c'est une grosse bétise.
BONNAFOUS Jean Marc
Trusted Contributor

Re: backup script


Sorry i forget script.

# Total Save:
BEGIN=`date`
fbackup -I index.log -f /dev/rmt/0m -i / 1>error.log 2>&1
if [ $? != ]
then
echo "Save error"
fi
END=`date`
echo "$BEGIN" >result.log
cat error.log >> result.log
echo "\n$END" >> result.log

JMB
Si vous ne faites jamais de bétises, c'est que vous ne faites rien de difficile. Et ça c'est une grosse bétise.
Steven E. Protter
Exalted Contributor

Re: backup script

Just so you understand what you get.

1) fbackup will not allow you to produce a DR backkup. The tape will not contain any usable boot information other than config files. You need ignite for a boot tape.
2) It will not back up open databases like oracle or mysql or informix. It will work cold if the database is down first.
3) Any normal file will be backed up. Files that were present at start of backup and disappear during the backup will show up on an error log.
4) It is possible to keep a file with fbackup and do incremental backups.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
I.Delic
Super Advisor

Re: backup script

thank you all for your response.

Sep thank you foor your explanation.
Of course ik make ignite tapes too.
Maybe i get it wrong. In case of disaster i should use my ignite tape to boot my system. with fbackup i want to set all file's back if i need it( vg01,v02).
After that, i kan use probackup (online backup of my progress database) to put my database back.

What doe jou mean with punt 2 in your explanation

Thank you in advance

Idriz


BONNAFOUS Jean Marc
Trusted Contributor

Re: backup script


fbackup cannot save databases files when databases is up because fbackup cannot save any open (active) files. For tis reason, fbackup must be use when users are disconnect and you must stop databases during the save. If you cannot stop databases for long time: stop databases, copy files on another directory on disk, restart databases, save on tape with fbackup except directory where are active database files (-e option of fbackup).

Rgds
JMB
Si vous ne faites jamais de bétises, c'est que vous ne faites rien de difficile. Et ça c'est une grosse bétise.