View previous topic :: View next topic |
Author |
Message |
AutoBot l33t
Joined: 22 Apr 2002 Posts: 968 Location: Usually Out
|
Posted: Fri May 10, 2002 3:29 am Post subject: Keep your /etc from getting toasted. |
|
|
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 _________________ 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 |
|
|
Guest
|
Posted: Wed May 15, 2002 10:01 am Post subject: |
|
|
SECURITYWARNING!!!
You better make sure ${BACKUPDIR} is NOT world-readable. Hint: shadow. |
|
Back to top |
|
|
mdpye Tux's lil' helper
Joined: 18 Apr 2002 Posts: 102 Location: Nottingham, England
|
Posted: Thu Jul 18, 2002 6:14 pm Post subject: Re: Keep your /etc from getting toasted. |
|
|
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>
but mine was crude, it didn't fit with the whole gentoo rc-scripts scheme. _________________ Cheers, MP |
|
Back to top |
|
|
AutoBot l33t
Joined: 22 Apr 2002 Posts: 968 Location: Usually Out
|
Posted: Thu Jul 18, 2002 10:31 pm Post subject: Re: Keep your /etc from getting toasted. |
|
|
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>
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 |
|
|
mdpye Tux's lil' helper
Joined: 18 Apr 2002 Posts: 102 Location: Nottingham, England
|
Posted: Fri Jul 19, 2002 9:41 am Post subject: Re: Keep your /etc from getting toasted. |
|
|
AutoBot wrote: | Ok edited, sorry about leaving you out |
Oh, thanks. I didn't expect to be written in or anything. _________________ Cheers, MP |
|
Back to top |
|
|
rojaro l33t
Joined: 06 May 2002 Posts: 732
|
Posted: Sun Jul 21, 2002 2:36 am Post subject: |
|
|
"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 |
|
|
razamatan Apprentice
Joined: 28 Feb 2003 Posts: 160
|
Posted: Mon Jul 07, 2003 4:13 am Post subject: |
|
|
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 |
|
|
koala Tux's lil' helper
Joined: 15 Aug 2002 Posts: 91 Location: Barcelona, Spain
|
Posted: Mon Jul 07, 2003 6:39 pm Post subject: |
|
|
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 |
|
|
|