Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Keep your /etc from getting toasted.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
AutoBot
l33t
l33t


Joined: 22 Apr 2002
Posts: 968
Location: Usually Out

PostPosted: Fri May 10, 2002 3:29 am    Post subject: Keep your /etc from getting toasted. Reply with quote

This is from something that happened to me and here is a nice script that will back up your /etc in a clean and orderly mannor, originally created by "mdpye" then further refined by "leaf" and "Roy":

Code:

#!/sbin/runscript
# Backs up /etc/*

start() {
    local BACKUPDIR="/var/backup"

    local DATE=`date +%Y%m%d`
    local files=`ls -r ${BACKUPDIR}/etc*.tar.gz`
    ebegin "Backing up /etc/* to ${BACKUPDIR}/etc-${DATE}.tar.gz"
    if [ ! -d ${BACKUPDIR} ]
    then
        mkdir -p ${BACKUPDIR}
    fi

    backup=3
    for arg in ${files}
    do
        if [ "${backup}" -le 0 ]
        then
            rm -f ${arg}
        else
            backup=$((${backup} -1))
        fi
    done

    tar -Pzcspf ${BACKUPDIR}/etc-${DATE}.tar.gz /etc
    eend $?
}

Save it as something like backup-etc in /etc/init.d/, then run (as root):
Code:

# chmod 0755 /etc/init.d/backup-etc
# rc-update add backup-etc default

And now your /etc is safe from mishap, thanks guys.

SideNote: you can also run it as a cron job if your an uptime freak :D
_________________
This message self destructed a long time ago.


Last edited by AutoBot on Thu Jul 18, 2002 10:34 pm; edited 1 time in total
Back to top
View user's profile Send private message
Guest






PostPosted: Wed May 15, 2002 10:01 am    Post subject: Reply with quote

SECURITYWARNING!!!
You better make sure ${BACKUPDIR} is NOT world-readable. Hint: shadow.
Back to top
mdpye
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2002
Posts: 102
Location: Nottingham, England

PostPosted: Thu Jul 18, 2002 6:14 pm    Post subject: Re: Keep your /etc from getting toasted. Reply with quote

AutoBot wrote:
This is from something that happened to me and here is what two Gentoo users "leaf" and "Roy" came up with:


<bruised ego>Actually I wrote the original script</bruised ego>
:P
but mine was crude, it didn't fit with the whole gentoo rc-scripts scheme.
_________________
Cheers, MP
Back to top
View user's profile Send private message
AutoBot
l33t
l33t


Joined: 22 Apr 2002
Posts: 968
Location: Usually Out

PostPosted: Thu Jul 18, 2002 10:31 pm    Post subject: Re: Keep your /etc from getting toasted. Reply with quote

mdpye wrote:
AutoBot wrote:
This is from something that happened to me and here is what two Gentoo users "leaf" and "Roy" came up with:


<bruised ego>Actually I wrote the original script</bruised ego>
:P
but mine was crude, it didn't fit with the whole gentoo rc-scripts scheme.


Ok edited, sorry about leaving you out ;)
_________________
This message self destructed a long time ago.
Back to top
View user's profile Send private message
mdpye
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2002
Posts: 102
Location: Nottingham, England

PostPosted: Fri Jul 19, 2002 9:41 am    Post subject: Re: Keep your /etc from getting toasted. Reply with quote

AutoBot wrote:
Ok edited, sorry about leaving you out ;)


Oh, thanks. I didn't expect to be written in or anything. :D
_________________
Cheers, MP
Back to top
View user's profile Send private message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Sun Jul 21, 2002 2:36 am    Post subject: Reply with quote

"Only wimps use tape backup: _real_ men just upload their important
stuff on ftp, and let the rest of the world mirror it ;)": -- Linus Torvalds
_________________
A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)
Back to top
View user's profile Send private message
razamatan
Apprentice
Apprentice


Joined: 28 Feb 2003
Posts: 160

PostPosted: Mon Jul 07, 2003 4:13 am    Post subject: Reply with quote

i made a backup script that you guys/gals might be interested in... same kinda goals...

https://forums.gentoo.org/viewtopic.php?p=401456
_________________
a razamatan doth speaketh,
"Never attribute to malice, that which can be adequately explained by stupidity"
Back to top
View user's profile Send private message
koala
Tux's lil' helper
Tux's lil' helper


Joined: 15 Aug 2002
Posts: 91
Location: Barcelona, Spain

PostPosted: Mon Jul 07, 2003 6:39 pm    Post subject: Reply with quote

Has anyone ever considered putting /etc in a CVS repository? Any ideas, experiences on that?

I think it could be useful to store past versions of config files et al.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum