Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-20-2008, 10:08 AM   #1
LQ Newbie
Registered: Oct 2008
Posts: 2

Rep: Reputation: 0
tar archival backups

I'm currently using rsync to sync two directories together for backup purposes. Along with this, I would like to create a tar archive every few days. Running this in a crontab is preferred. How do I create this tar automatically with a new date everytime it is ran? Thanks!
Old 10-20-2008, 02:25 PM   #2
Registered: Jun 2005
Location: U.S.
Distribution: xubuntu 8.10, linux 2.6.27-11-generic
Posts: 78

Rep: Reputation: 16
Sounds like you know how to use cron, so I guess you're asking how to get date/time info from command line?

man date
Old 10-20-2008, 10:24 PM   #3
Senior Member
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 4,703

Rep: Reputation: 730Reputation: 730Reputation: 730Reputation: 730Reputation: 730Reputation: 730Reputation: 730
Yeah but the trick is how to get a decent filename for tar. This is the command line:
/bin/tar -cf mybackup_$(/bin/date +%Y%m%d).tar /dir_to_backup

The filename part is mybackup_$(/bin/date +%Y%m%d).tar. Check the correct tar syntax, not sure without trying.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
backups using tar and rsync cucolin@ Linux - Server 2 04-03-2007 01:25 AM
security for backups (tar command) wedgeworth Linux - Software 1 03-18-2004 12:00 PM
tar or cpio - Which is better for tape backups? Br. Nicholas Linux - Software 2 07-02-2003 05:06 PM
Large backups or Tar doesn't work jeanpba Linux - Hardware 1 10-04-2002 11:04 AM
Incremental tar backups Pepe Linux - General 5 03-18-2002 04:31 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:26 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration