LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-08-2004, 10:04 PM   #1
b123coder
Member
 
Registered: Nov 2004
Location: india
Distribution: Fedora core 1
Posts: 67

Rep: Reputation: 15
writing backup script


i am working on some source code and i want to have backups of my source directory each time i shutdown linux machine. But i want that backups stored in incremental manner? ex. On Day 1 if i shutdown machine 3 times the backup files should be created as mybackup1.tar.gz mybackup2.tar.gz mybackup3.tar.gz.
On day 2 it proceeds as mybackup4.tar.gz....

how can i write this script?
 
Old 12-09-2004, 03:03 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
personally i'd use a datestamp, but you could use wc to get the incremented value.

$num=`ls -1 /var/backup/mybackup* | wc -l`
 
  


Reply



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
Need help writing a script wswartz Linux - Software 3 04-28-2004 03:35 PM
Help writing a rm script VisionZ Linux - Newbie 17 03-24-2004 07:15 AM
Help Writing a script. teeth44 Programming 2 10-14-2003 12:00 PM
Writing a Script Nyc0n Linux - General 2 05-27-2002 07:21 PM
writing a Script spanky5125 Linux - Security 5 01-08-2002 09:22 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:46 PM.

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