Ubuntu Server Guide Changes, errors and bugs
References • See the Ruby on Rails website for more information. • Also Agile Development with Rails is a great resource. Backups
Download 1.27 Mb. Pdf ko'rish
|
ubuntu-server-guide
- Bu sahifa navigatsiya:
- Archive Rotation
- Rotating NFS Archives
References
• See the Ruby on Rails website for more information. • Also Agile Development with Rails is a great resource. Backups There are many ways to backup an Ubuntu installation. The most important thing about backups is to develop a backup plan consisting of what to backup, where to back it up to, and how to restore it. It is good practice to take backup media off-site in case of a disaster. For backup plans involving physical tape or removable hard drives, the tapes or drives can be manually taken off-site, but in other cases this may not be practical and the archives will need copied over a WAN link to a server in another location. Archive Rotation The shell script in Shell Scripts only allows for seven different archives. For a server whose data doesn’t change often, this may be enough. If the server has a large amount of data, a more complex rotation scheme should be used. Rotating NFS Archives In this section, the shell script will be slightly modified to implement a grandfather-father-son rotation scheme (monthly-weekly-daily): • The rotation will do a daily backup Sunday through Friday. • On Saturday a weekly backup is done giving you four weekly backups a month. • The monthly backup is done on the first of the month rotating two monthly backups based on if the month is odd or even. Here is the new script: #!/ b i n / bash #################################### # # Backup t o NFS mount s c r i p t with # g r a n d f a t h e r −f a t h e r −son r o t a t i o n . # #################################### # What t o backup . b a c k u p _ f i l e s =”/home / var / s p o o l / m a i l / e t c / r o o t / boot / opt ” # Where t o backup t o . d e s t =”/mnt/ backup ” # Setup v a r i a b l e s f o r t h e a r c h i v e f i l e n a m e . day=$ ( d a t e +%A) hostname=$ ( hostname −s ) 303 # Find which week o f t h e month 1−4 i t i s . day_num=$ ( d a t e +%−d ) i f ( ( $day_num <= 7 ) ) ; then w e e k _ f i l e =”$hostname−week1 . t g z ” e l i f ( ( $day_num > 7 && $day_num <= 14 ) ) ; then w e e k _ f i l e =”$hostname−week2 . t g z ” e l i f ( ( $day_num > 14 && $day_num <= 21 ) ) ; then w e e k _ f i l e =”$hostname−week3 . t g z ” e l i f ( ( $day_num > 21 && $day_num < 32 ) ) ; then w e e k _ f i l e =”$hostname−week4 . t g z ” f i # Find i f t h e Month i s odd o r even . month_num=$ ( d a t e +%m) month=$ ( expr $month_num % 2 ) i f [ $month −eq 0 ] ; then mo n t h _ f il e=”$hostname−month2 . t g z ” e l s e mo n t h _ f il e=”$hostname−month1 . t g z ” f i # C r e a t e a r c h i v e f i l e n a m e . i f [ $day_num == 1 ] ; then a r c h i v e _ f i l e=$ m o n t h _ f il e e l i f [ $day != ” Saturday ” ] ; then a r c h i v e _ f i l e =”$hostname−$day . t g z ” e l s e a r c h i v e _ f i l e=$ w e e k _ f i l e f i # P r i n t s t a r t s t a t u s message . echo ” Backing up $ b a c k u p _ f i l e s t o $ d e s t / $ a r c h i v e _ f i l e ” d a t e echo # Backup t h e f i l e s u s i n g t a r . t a r c z f $ d e s t / $ a r c h i v e _ f i l e $ b a c k u p _ f i l e s # P r i n t end s t a t u s message . echo echo ” Backup f i n i s h e d ” d a t e # Long l i s t i n g o f f i l e s i n $ d e s t t o check f i l e s i z e s . l s −l h $ d e s t / The script can be executed using the same methods as in Executing the Script. As discussed in the introduction, a copy of the backup archives and/or media can then be transferred off-site. Download 1.27 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling