Web Hosting Talk







View Full Version : Backup Script Help


daveman
12-02-2002, 03:04 AM
I currently have this script that runs nightly via cron. I want to change it so it keeps every tar from the current week, the past month it keeps one from every sunday, then before that only keeps one from the 1st of every month. Any help is apreciated and thanks.

#!/bin/sh

DATESTAMP=`date +%m-%d-%Y-%H%M`

tar -czf /home/virtual/site/backup/homes/$DATESTAMP-homes.tar.gz /home/virtual/site/home

daveman
12-03-2002, 10:52 PM
_____________________________UUU____MM_________________PPP__________
_BBBBBBBBBBBBB___UU__________UUU__MMMM_______________PPPPPPPP_______
BBBBBBBBBBBBBBB_UUUU________UUUU__MMMM___________MMM_PPPPPPPPPP_____
BB_BBB____BBBBB_UUUU________UUUU__MMMM__________MMMM__PPPPPPPPPP____
__BBBB_____BBBB_UUUU_______UUUU___MMMM_________MMMMM__PPPP_PPPPPP___
_BBBBB___BBBBB__UUUU_______UUUU___MMMMM______MMMMMMM__PPPP___PPPPP__
_BBBB__BBBBB____UUUU_______UUUU__MMMMMM_____MMMMMMM___PPPP____PPPP__
_BBBBBBBBB______UUUU______UUUU___MMMMMMM__MMMMMMMMM___PPP_____PPPP__
BBBBBBB_________UUUU______UUUU___MMMMMMMMMMMM__MMM___PPPP_____PPPP__
BBBBBBB_________UUUU_____UUUU____MMM_MMMMMMM___MMM___PPPP____PPPP___
BBBBBBBBBBB_____UUUU_____UUUU____MMM___MMM____MMMM___PPP___PPPPPP___
_BBB_BBBBBBBB___UUUU____UUUUU____MMM__________MMM____PPPPPPPPPP_____
_BBB_____BBBBB___UUUU__UUUUUU____MMM__________MMM___PPPPPPP_________
_BBB____BBBBBB___UUUUUUUUUUU____MMMM__________MMM__PPPP_____________
_BBBBBBBBBBBBB____UUUUUU_UUUU___MMM__________MMM____PPP_____________
BBBBBBBBBBB________UUU___UUUS___MMM__________MM_____PPPP____________
BBBBBBB_____________________________________________PPPP____________
_BB_________________________________________________PPP_____________
____________________________________________________________________

Jtru
12-03-2002, 11:49 PM
Can't help you, but I have to say that was the coolest, most impressive bump I've ever seen. :D

daveman
12-04-2002, 12:42 AM
Originally posted by Jtru
Can't help you, but I have to say that was the coolest, most impressive bump I've ever seen. :D
Thanks, I didn't make it but feel free to use it.

kunal
12-04-2002, 02:56 AM
Originally posted by daveman
_____________________________UUU____MM_________________PPP__________
_BBBBBBBBBBBBB___UU__________UUU__MMMM_______________PPPPPPPP_______
BBBBBBBBBBBBBBB_UUUU________UUUU__MMMM___________MMM_PPPPPPPPPP_____
BB_BBB____BBBBB_UUUU________UUUU__MMMM__________MMMM__PPPPPPPPPP____
__BBBB_____BBBB_UUUU_______UUUU___MMMM_________MMMMM__PPPP_PPPPPP___
_BBBBB___BBBBB__UUUU_______UUUU___MMMMM______MMMMMMM__PPPP___PPPPP__
_BBBB__BBBBB____UUUU_______UUUU__MMMMMM_____MMMMMMM___PPPP____PPPP__
_BBBBBBBBB______UUUU______UUUU___MMMMMMM__MMMMMMMMM___PPP_____PPPP__
BBBBBBB_________UUUU______UUUU___MMMMMMMMMMMM__MMM___PPPP_____PPPP__
BBBBBBB_________UUUU_____UUUU____MMM_MMMMMMM___MMM___PPPP____PPPP___
BBBBBBBBBBB_____UUUU_____UUUU____MMM___MMM____MMMM___PPP___PPPPPP___
_BBB_BBBBBBBB___UUUU____UUUUU____MMM__________MMM____PPPPPPPPPP_____
_BBB_____BBBBB___UUUU__UUUUUU____MMM__________MMM___PPPPPPP_________
_BBB____BBBBBB___UUUUUUUUUUU____MMMM__________MMM__PPPP_____________
_BBBBBBBBBBBBB____UUUUUU_UUUU___MMM__________MMM____PPP_____________
BBBBBBBBBBB________UUU___UUUS___MMM__________MM_____PPPP____________
BBBBBBB_____________________________________________PPPP____________
_BB_________________________________________________PPP_____________
____________________________________________________________________

WOOOOOOOOOWIEEE!!! :eek:

hololi
12-04-2002, 11:50 AM
ignoring the fantastic bump replies off the top of my head you need 2 scripts

the one for the taring you have is fine


you'll need another one to nuke the tar's you don't need cron "nuke" to run after your archiving one that kills all the tar youdon't want.

haven't written one in a while but you will have to do some messing with `date` and rm the ones you find that don't match your criteria.

I'll have a think about it over the next few days and hopefully come up with a few suggestions

BTW : why do you want to nuke archives storage is now so cheap ?

daveman
12-04-2002, 01:29 PM
Originally posted by hololi

I'll have a think about it over the next few days and hopefully come up with a few suggestions

BTW : why do you want to nuke archives storage is now so cheap ?
Thanks! :D

The reason is that the next part of my script will ftp the tars offsite each time. Thus on the server I only need some of the backups and not all.