Avatar of bkreynolds48
bkreynolds48 asked on

TAR does not use $FILES

#######################################################################
#!/bin/ksh
# set +xv
# File: /bkup.sh
#######################################################################
#
DATE=`date +%m%d%y`
BULOG=/root/logs/bkup_$DATE.log
FILES=/root/logs/files
#
########### Start of the script. ######################################
echo " BACKUP started at `date`" > $BULOG 2>&1
echo "Where am I?" >>$BULOG
pwd >>$BULOG
find /var/subversion -print |egrep -v '*.dump' |egrep -v '*.tar' |egrep -v '*.bak' > $FILES
find /usr/nagios -print >>$FILES
#
mt -f /dev/st0 rewind
#
tar -cvf /dev/nst0   --files-from=$FILES >> $BULOG 2>&1
#
mt -f /dev/st0 rewind
#
echo " BACKUP finished at `date`" >> $BULOG 2>&1
#
####################### End of Script #################################


It looks like the tar command is NOT really using the $FILES ????


====Here is the tar command running on the system
tar -cvf /dev/nst0 --files-from=/root/logs/files
==== here is what is in $FILES
head files
/var/subversion
/var/subversion/brad
/var/subversion/brad/conf
/var/subversion/brad/conf/svnserve.conf
/var/subversion/brad/conf/passwd
/var/subversion/brad/conf/authz
/var/subversion/brad/dav
/var/subversion/brad/format
/var/subversion/brad/db
/var/subversion/brad/db/uuid
====here is the tar log file
head *.log
 BACKUP started at Wed May 28 12:25:12 CDT 2008
Where am I?
/root/logs
tar: Removing leading `/' from member names
/var/subversion/
/var/subversion/tim.dump.bak
/var/subversion/oracle.dump
/var/subversion/brad/
/var/subversion/brad/conf/
/var/subversion/brad/conf/svnserve.conf
Linux

Avatar of undefined
Last Comment
omarfarid

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
ozo

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
bkreynolds48

Thanks - looks like that is working.  I wasn't sure if the -type would work it's way down the file system tree.
omarfarid

it is working perfect with me:

[omar@F8 ~]$ tar cvf /tmp/f.tar --files-from=/tmp/file
tar: Removing leading `/' from member names
/etc/hosts
/etc/passwd
/etc/group
/bin/ls
/bin/tar
[omar@F8 ~]$ cat /tmp/file
/etc/hosts
/etc/passwd
/etc/group
/bin/ls
/bin/tar
[omar@F8 ~]$ tar tvf /tmp/f.tar
-rw-r--r-- root/root       188 2008-03-07 16:59 etc/hosts
-rw-r--r-- root/root      1950 2028-12-05 20:43 etc/passwd
-rw-r--r-- root/root       839 2028-12-05 20:42 etc/group
-rwxr-xr-x root/root     99564 2008-03-25 22:04 bin/ls
-rwxr-xr-x root/root    272456 2008-02-12 18:00 bin/tar


can you run

tar tvf /dev/nst0

and compare with your files to be backed up?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy