Friday, June 3, 2011

Small script to backup IBM Informix raw data from SCO Unix to an FTP server

Yesterday I got access to a broken SCO Unix Server, having IBM Informix database. The database had lots of data on raw disks. Luckily I got the server to boot to single user mode, from there I got access to the locations of files using 'divvy' command.

Auto login to FTP server setup using .netrc in the home directory of user "root"
# sh
# cat > /.netrc <<EOF
machine 192.168.20.100
user ftpuser
pass ftppassword
EOF

Start the backup, first taking the list of files and then looping through the list and while doing the backup using dd. The backed-up file is ultimately moved to an FTP server
# mount /backup
# cd /backup
# find / -name \*data\* -user informix > /tmp/files
# for i in `cat /tmp/files` ; do
>  dd if=/dev/$i of=/backup/$i > /tmp/ddlog
>  echo "bin\nput $i\nquit"|ftp 192.168.20.100
>  rm /backup/$i
> done

No comments:

Post a Comment