LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-29-2007, 02:31 AM   #1
grayswander
Member
 
Registered: Apr 2003
Location: Israel
Distribution: Gentoo
Posts: 61

Rep: Reputation: 15
mkbck (Make Backup) anouncement


Good time of day to everyone!

NOTE: This is not a question, but a little announcement.

I've started a project mkbck - Make Backup recently, and want to announce it here. I believe it can be useful for a lot of people, who use CLI for system administration.

A couple of years ago I've started working as system administrator. Quickly I figured out that having backup copies of important files at hand BEFORE you edit them makes you sleep better at night, instead of preparing another cup of coffee late at night, trying to make something work again.

I started using
# cp file file.date
before editing mentioned file, especially in /etc :-)

But it quickly became annoying to look at the clock and type date manually 5 times per minute.
I tried to find something to do it for me, and found nothing.

I wrote a simple shell script to perform a task. Shortly, simple cp+date inside was not enough for me. For example, i wanted to make backup and edit original in ONE command, and not two, and not bother about absolute and relative paths.

So I wrote mkbck:
Usage: mkbck [-mvVeh] [-d destination] [-s suffix] <target(s)>
Where: -m - move target instead of copying it
-e - edit target after backup
-h - display this help
-v - human readable verpose output
-V - machine parsable verbose output
format - cp/mv:dir/file:target:destination
target - file/directory to be backed up
-d dest - optional directory to place backup
into. Default is the target's base directory.
-s suffix - optional arbitrary suffix

The backup file name is : ${TARGET}.b.`date +"%Y%m%d-%H%M"`[-<COUNT>]
For example :
backup of mkbck on Mon May 30 16:55:05 IDT 2005
would be mkbck.b.[suffix.]20050530-1655

This script worked for 2 years in 3 very heterogeneous environments, and a couple of days ago I've uploaded it on SourceForge.

I will be glad, if this script will be useful general public.
 
Old 03-29-2007, 02:38 AM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
Interesting little trick there. I will have to take a look at it. I have found myself in quite a jam after accidentally deleting/corrupting a file in the past, and this looks very handy (assuming I remember to make the backup before editing at least...).
 
Old 03-29-2007, 02:40 AM   #3
grayswander
Member
 
Registered: Apr 2003
Location: Israel
Distribution: Gentoo
Posts: 61

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by MS3FGX
Interesting little trick there. I will have to take a look at it. I have found myself in quite a jam after accidentally deleting/corrupting a file in the past, and this looks very handy (assuming I remember to make the backup before editing at least...).
Exactly for this reason I've added -e option...
 
Old 03-29-2007, 01:00 PM   #4
wpn146
Member
 
Registered: Jan 2005
Distribution: Solaris, Linux Fedora Core 6
Posts: 170

Rep: Reputation: 30
Have you considered putting important files into RCS?

We probably dislike being forced into code control, but when we are the one doing the forcing, it is much less painful. RCS allows one to rollback a file from any save, lets us do a "diff" so we can see what we did, and doesn't clutter up the directory with multiple versions of the same file.
 
Old 03-29-2007, 03:19 PM   #5
grayswander
Member
 
Registered: Apr 2003
Location: Israel
Distribution: Gentoo
Posts: 61

Original Poster
Rep: Reputation: 15
I'll give you the reasons not to do so:
1) You still have to input 2 commands
2) RCS(CVS,Subversion) are more complicate to work with.
3) You never know what file you'll have to backup next.
4) RCS(CVS,Subversion) installation and configuration is much more complicate than just put a single script in PATH
5) You don't really want to add the burden of technical support for RCS(CVS,Subversion) on hundred or so servers on your neck
6) You don't really need such complex system.

IMHO, single script with many options is better solution in this case.
 
Old 03-29-2007, 04:00 PM   #6
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Might work fine on a standalone server or desktop, but I'd recommend something like cfengine and machines with backups running daily incrementals for those dealing with a farm of servers. It might be a hassle to restore from backups if you do mess up any given file but you know they're there if you need them.

Personally I wouldn't have any use for a local backup file before editing, I rarely make mistakes and I'd only be concerned if I accidently lost the file. And then again, make a mistake, just reopen and edit it again.

Sorry for the negativity, just a personal thing as it's just as easy to implement an alias with $DATE to cp a file before opening it up to edit if I really needed something like this..

Last edited by trickykid; 03-29-2007 at 04:01 PM.
 
Old 05-01-2007, 12:56 AM   #7
grayswander
Member
 
Registered: Apr 2003
Location: Israel
Distribution: Gentoo
Posts: 61

Original Poster
Rep: Reputation: 15
Quote:
Might work fine on a standalone server or desktop, but I'd recommend something like cfengine and machines with backups running daily incrementals for those dealing with a farm of servers. It might be a hassle to restore from backups if you do mess up any given file but you know they're there if you need them.
As I said, it's LOCAL TEMPORARY backup. Just to make sure, that if you have made typo in, say, /etc/profile on login server, you can QUICKLY revert the changes before angry users start calling you. Decent backup systems are not suitable for this purpose, because they are too slow. It takes too much time to open backup software, find needed file, load LTO-2 tape, rewind it to needed file and restore.
Quote:
Personally I wouldn't have any use for a local backup file before editing, I rarely make mistakes and I'd only be concerned if I accidently lost the file. And then again, make a mistake, just reopen and edit it again.
It depends on mistake one makes. You can, for example, accidentally press 2 keys instead of one.
Imagine in VI: instead of 5-d-d press 45-d-d. And save.. And save again.. Oops. Unlikely, but possible.

Quote:
Sorry for the negativity, just a personal thing as it's just as easy to implement an alias with $DATE to cp a file before opening it up to edit if I really needed something like this..
Mine is just another solution for the same problem. Just more sophisticated and IMHO user-friendly.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How-To make a Full Backup of Slackware 11.0 slackamp Slackware 1 11-08-2006 03:02 PM
dd to make backup of partition titopoquito Slackware 6 08-02-2006 09:55 AM
How do I make a backup .iso of my setup? Charos MEPIS 16 08-28-2005 04:01 PM
How to make a backup server out of Slackware? unixfreak Linux - Newbie 12 08-12-2004 08:09 PM
make new Partiton for backup while re-install qwijibow Linux - Newbie 1 08-30-2003 03:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:34 AM.

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