- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- tar and exclude directories
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2005 02:11 AM
тАО08-19-2005 02:11 AM
tar and exclude directories
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2005 02:21 AM
тАО08-19-2005 02:21 AM
Re: tar and exclude directories
There is no exclude option in tar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2005 02:26 AM
тАО08-19-2005 02:26 AM
Re: tar and exclude directories
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2005 02:30 AM
тАО08-19-2005 02:30 AM
Re: tar and exclude directories
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2005 02:32 AM
тАО08-19-2005 02:32 AM
Re: tar and exclude directories
Yes with find you can always "reverse" the options with ! (e.g find . ! -name xyz ).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2005 03:25 AM
тАО08-19-2005 03:25 AM
Re: tar and exclude directories
That's acceptable IMO as long as You can be sure the target host also has a GNU tar installed.
Otherwise, You could go with find / [options/excludes] -cpio or tar and xargs...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2005 03:27 AM
тАО08-19-2005 03:27 AM
Re: tar and exclude directories
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2005 03:38 AM
тАО08-19-2005 03:38 AM
Re: tar and exclude directories
find /home/customers | grep -v "/archive/" > /tmp/files2xfer
find /home/customers | grep "/archive/" > /tmp/files2xclude
as you can see, the output of these two commands make up the whole /home/customers directory contents. So, scan the /tmp/files2xclude file to see it is not excluding something that you want backed up otherwise. If you find such a file, move the line to /tmp/files2xfer
then
for file in `cat /tmp/files2xfer`
do
tar -rvf /dev/rmt/0mn $file
done
it will take a while as it will append every file one by one but I think this will do the job. Keep in mind that this is a theory. I have never done this for myself in my sysadmin life. So, be cautious and test it in a smaller directory structure first to see if the times are acceptable.
HTH
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2005 05:08 AM
тАО08-19-2005 05:08 AM
Re: tar and exclude directories
What I do on my Linux servers:
#!/bin/bash
# Script to backup Home Directories
#
LOGFILE=/tmp/dumphome.log
GZFILE=`date |awk '{print ($1)}'`.tar.gz
#GZFILE=`date |awk '{print ($3)}'`.tar.gz
TARFILE=`date |awk '{print ($1)}'`.tar
#TARFILE=`date |awk '{print ($3)}'`.tar
echo "Backup of Home Dir on Dune at " `date` >$LOGFILE 2>&1
# remove the old gzip file
if [ -f /home/backups/$GZFILE ]; then
rm -f /home/backups/$GZFILE >>$LOGFILE 2>&1
else
echo "no old $GZFILE found..." >>$LOGFILE 2>&1
fi
# backup the files
tar -cf /home/backups/$TARFILE `cat /root/backupfiles` >>$LOGFILE 2>&1
# gzip the tar file
gzip /home/backups/$TARFILE >>$LOGFILE 2>&1
chown a2b2000 /home/backups/$GZFILE
echo "/home/dumphome is complete " `date` >>$LOGFILE 2>&1
mail -s "Dune: Home Backup Complete" gjwild <$LOGFILE
cat /root/backupfiles
/bin
/boot
/dev
/etc
/home/aquota.user
/home/ftp
/home/httpd
/home/info
/home/webmaster
/initrd
/lib
/misc
/mnt
/opt
/proc
/root
/sbin
/scripts
/tmp
/usr
/var
Notice, that I don't backup /home/backups.....
So, you would have to explicitly set all file in the customer directories...
/home/customers/user1/files
/home/customers/user1/morefiles
/home/customers/user1/anotherdir
/home/customers/user1/.profile
etc...
Rgds...Geoff