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
user ftpuser
pass ftppassword

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
>  rm /backup/$i
> done

1 comment:

  1. I had never understood the thing about the auto login. Although I had tried a couple of codes and also took help from the friends but it changed after getting the concept from this code.