0

I am looking to make an archive of my root directory, but only certain folders/files. So far, this is what I have, can you please tell me what I'm doing wrong? For the purposes of figuring out the issue, I've got 3 test files (test1, etc) in the /home/user directory that I'm trying to archive with cpio, with the folder name being the date. Bear with me, as I'm fairly new at this. Thanks.

today="$(date +%m%d%Y)"

mkdir /home/user/backuptest/$today

LIST="test1 test2 test3"

for i in $LIST

do

find $i -print | cpio -pduv /home/user ;

find $i -print | cpio -pduv /home/user/backuptest/$today

done

koo
  • 23

1 Answers1

0

Excerpts of my home backup script, for what it's worth:

set DIRS = "/etc /root /usr/home /usr/local/etc"
set TMPFILE = /tmp/tar-`date "+%F_%T"`.tmp
set FILENAME = /backup/backup-`hostname -s`_`date "+%F"`.tbz

# Build list of files to be backed up
foreach LOCATION ($DIRS)
    find $LOCATION -type fl >> $TMPFILE
end

# Do actual backup
tar cyfTP - $TMPFILE | dd bs=10k of=$FILENAME

# Cleanup list of files
rm -f $TMPFILE

Note: There's a lot of round about ways of doing things in there because I actually pipe the archive through LZMA Compression, Blowfish Encryption, Full/Incremental/Differential Backups, and write to either File or Tape.

Chris S
  • 78,455