1851750 Members
2195 Online
104062 Solutions
New Discussion

Re: working with scripts

 
SOLVED
Go to solution
Burhan Koni
Advisor

working with scripts

I need to do backup on hp-UX server. I have a large number of selected files to include them in backup. I need to know how to list them in a script


many thanks
7 REPLIES 7
Jeff Schussele
Honored Contributor

Re: working with scripts

Hi Burhan,

You should use the fbackup command & then use the graph files option to include what you want.
Do a man on fbackup
Also allows incrementals as well as incremental levels i.e. monthly / weekly / daily.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
James R. Ferguson
Acclaimed Contributor
Solution

Re: working with scripts

Hi:

Have a look at the man pages for 'fbackup'. You can create "graph" files which can (both) include and exclude files and directories. The graph is a simple ascii file that looks like:

i /tmp
i /var
e /var/tmp

Note, therefore, that you can exclude subdirectories and/or files that have been included by virtue of selecting a higher member of a directory.

Regards!

...JRF...
MANOJ SRIVASTAVA
Honored Contributor

Re: working with scripts

Hi Burhan

If the files sizes are less than 2.0Gb then the simplest to do is to put files with the path ( using may be find ) in a file and do a

tar cvf /dev/rmt/0m `cat filename`

this will back up the files on the tape.


Manoj Srivastava
Vijeesh CTK
Trusted Contributor

Re: working with scripts



hi

Use fbackup for taking selective backup it is veru useful.. See man pages of fbackup.

here is my command

fbackup -f /dev/rmt/0m -g fbackup.graph -v -d fbackup.log -u 2>&1|tee -a fbackup.out

this is simple script

in fbackup.graph include what u want to take backup with the complete path

fbackup.graph
i /stand # full filesys
i /var/adm/syslog.log # file
e /opt # exclude opt
e /usr # exclude usr

this is sample graph file

CTK
S.K. Chan
Honored Contributor

Re: working with scripts

To echo James reply, once you got the "include" and "exclude" entries in a file "graphfile" you would perform your fullbackup like so ..

# fbackup -f /dev/rmt/0m -g /tmp/graphfile
===> assuming your tape device is "0m"
Peter Klausner_1
Frequent Advisor

Re: working with scripts

The tar ... `cat file` approach works in principle. But depending on your shell's configuration, the argument list will run out of space. A complete file system listing most certainly will not work.

Workaround:
find ... | xargs tar cvf /dev/...

xargs takes stdin, loops over your command, ie tar, and hands over the argument list in chunks as big as possible
H.Merijn Brand (procura
Honored Contributor

Re: working with scripts

using tar and xargs is not a very nice way to go. Skip to GNU tar, which can use index files (like cpio)

presuming you've installed GNU tar as ntar (not in HP's distribution, but for sure worthwhile to install), use it like this

# echo index > index
# find .... -type f >>index
# ntar -c -f /dev/rmt/0m -T index

the first line puts the index on tape first, so asking for what is on the tape now does not require you to read the whole tape with 'tar -t', but

# ntar -x -f /dev/rmt/0m index

will suffice
Enjoy, Have FUN! H.Merijn