Aix shell scripting

skege
skege used Ask the Experts™
on
Hello!

This is my first post so please understand =)
First Sorry for my bad english..

I want to verify that my nfs mount is ok before i run the backup script. I tried next:

[code)

#!/bin/bash
#test

   if [ -a /mnt/backup/test.nfs ]; then
cp -R /data1/* /mnt/backup/data1
cp -R /data2/* /mnt/backup/data2
   else
       echo backup failed!
fi

[/code]

/mnt/backup/test.nfs is file that i create on nfs drive..
and the script checks if the file exist and if it exists script runs "backup".

That script work fine on the linux machine, but what do i must exchange to get that script work in IBM RS6000/AIX 4.3?

Hope somebody understand what i´am trying to say =)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
The script should behave the same way in AIX as in Linux, IF YOU have "bash" installed and the bash binary is in /bin at the AIX box.

do a:
ls /bin/bash to find out

otherwise, just change the script header to:
#!/bin/ksh

and keep the other statements unchange.

Author

Commented:
yesh, sorry there is no bash in AIX box..
I test the script

Author

Commented:
./backuptest[2]: [-a:  not found.
backup failed!

script returns something like that.
And I am sure that /mnt/backup/test.nfs file exists.
Any suggestions?
ok change the script to:

#!/bin/ksh
if [ -r /mnt/backup/test.nfs ]; then
   cp -R /data1/* /mnt/backup/data1
   cp -R /data2/* /mnt/backup/data2
else
      echo "backup failed!"
fi

#End

If you have rsync install on your system, use rsync for backup, or consider to use tar backup your file instead of "cp"

man rsync
man tar
to find out more details


Author

Commented:
Thanks that works!

Normally i use rsync but i dont own these machines and i have no rights to install rsync :)

And i don`t use tar because customer wants use cp..don`t ask why.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial