토요일, 2월 28, 2009

linux 기반 flame / smoke 시스템 백업 자동화 시키기

#!/bin/bash
DATE=`date +"%Y%m%d"`PREV_DATE=`date +"%Y%m%d" --date '3 days ago'`
LOG_DIR=/backup/log
CFG_DIR=/backup/cfg
PROJECT_DIR=/backup/project
CLIP_DIR=/backup/clip
LICENSE_DIR=/backup/license
ARCHIVE_DIR=/backup/archive
SETTING_DIR=/backup/etc
tar cvf ${LOG_DIR}/discreet_log_${DATE}.tar /usr/discreet/log /usr/discreet/sw/log
tar cvf ${CFG_DIR}/discreet_cfg_${DATE}.tar /usr/discreet/sw/cfg
tar cvf ${PROJECT_DIR}/discreet_project_${DATE}.tar /usr/discreet/project
tar cvf ${CLIP_DIR}/discreet_clip_${DATE}.tar /usr/discreet/clip
tar cvf ${LICENSE_DIR}/discreet_license_${DATE}.tar /usr/local/flexlm/licenses /usr/discreet/sparks
tar cvf ${ARCHIVE_DIR}/discreet_archive_${DATE}.tar /usr/discreet/archive
tar cvf ${SETTING_DIR}/setting_${DATE}.tar /etc
rm ${LOG_DIR}/discreet_log_${PREV_DATE}.tar
rm ${CFG_DIR}/discreet_cfg_${PREV_DATE}.tar
rm ${PROJECT_DIR}/discreet_project_${PREV_DATE}.tar
rm ${CLIP_DIR}/discreet_clip_${PREV_DATE}.tar
rm ${LICENSE_DIR}/discreet_license_${PREV_DATE}.tar
rm ${ARCHIVE_DIR}/discreet_archive_${PREV_DATE}.tar
rm ${SETTING_DIR}/setting_${PREV_DATE}.tar


위의 내용을 /etc/cron.daily/discreet.sh 에 저장해놓고

* 위의 내용외에 더 필요한게 있다면 추가해주면 된다. 예를 들어서
mutt -x -a ${LOG_DIR}/discreet_log_${DATE}.tar -s "cl_post_flame_log" artisanm@gmail.com < /dev/null
를 추가해주면 백업된 log 파일을 지정된 관리자에게 자동으로 메일로 보낼수 있다.
(sendmail 이나 mutt 설정이 제대로 되어 있다면)
물론, 실제로 저렇게 추가해주면 백업된 log 파일 크기가 메일용량 제한에 걸려서 보내지못하겠지만..*

chmod 755 /etc/cron.daily/discreet.sh

crontab -e

0,30 4 * * * /etc/cron.daily/discreet.sh

vi 명령어로 추가해주고

:wq!

저장한후

crontab -l

적용된걸 확인할수 있다.

매일 4시 30분에 위에 지정된 내용이 자동으로 백업되며

3일이 지난 백업 자료는 자동으로 삭제된다.

별도의 지정된 Backup 서버가 존재하는 경우 위의 script 에서 FTP 자동 전송관련 내용을

추가로 만들어주면 백업 자료를 자동으로 FTP 전송 시켜놓을수도 있다.

* 물론, 로컬망내 Backup 서버뿐만이 아니라 원격지에
별도의 Backup 서버가 존재한다면, 이 역시도 가능하다. *

* 별도로 지정된 Backup 서버가 NFS 마운트 되어 있는 상황이라면 FTP 전송시킬 필요도 없다. *


예전 Backdraft 의 경우는 스톤 볼륨 자료를 File Archive 로

crontab 을 이용해서 자동 백업 시킬수 있었는데

* 즉, 스케쥴링이 가능하게끔 Job Management panel 에서
Job list 를 만들어 놓고 Command 상태에서 background processing
시킬수 있으며 crontab 에 등록 시켜놓으면 File Archive 로 자동 백업이 가능하다. *

Backdraft Conform 버전부터 이 기능이 없어진것 같다.

이 기능이 된다면 스톤 볼륨 자료까지 자동 백업화 되는것이므로

도저히 손쓸수 없는 그 어떤 극한의 상황에서도 적어도 백업 자료가 존재 하는 범위의 자료까지는

빠르고 손쉽게 100% 복구가 가능하다.

* 누군가 잘못 손대서 완전 망쳐놨다고 하더라도.. *


* 물론, 이 기능이 현재는 지원되지 않고 있으며, 지원된다고 치더라도 누군가는 매일 Job list 를 수정해줘야 하며,
다수의 flame / smoke 시스템이 구축된 포스트 프로덕션이라면 이 작업도 상당히 번거로울수는 있을것이다.
그렇지만, 한번이라도 복구 불가로 자료를 날려본 포스트 프로덕션이라면 이까짓 번거로움이야..^^ *

anyway,

이론적으로는 그러하다는 말이다.


PS.


위의 내용에 추가해서 SystemCentral 을 적용시켜 보고자 한다.

우선 SystemCentral 은 Command 상태에서 사용가능하며

[root@aRTiSAn ~]# SystemCentral -l
===========================[List of Plugins detected]===========================
[Topic] Configuration
[Plugin] Configuration/run_dlConfigCheck (Run dlConfigCheck)
[Topic] Graphics
[Plugin] Graphics/dviRamp (DVI Ramp)
[Plugin] Graphics/getNvidiaInfo (NVIDIA Information)
[Topic] Network
[Plugin] Network/getNetworkConfig (Show Network Config Files)
[Plugin] Network/testTcpThroughput (TCP Throughput)
[Topic] Storage
[Plugin] Storage/mapSCSIDrives (Mapped SCSI Drives)
[Plugin] Storage/mountPoint (Mount Point Check)
[Plugin] Storage/tape_drive_test (Tape Drive Test)
[Plugin] Storage/XFSFragmentation (XFS Fragmentation)
[Topic] StoneFS
[Plugin] Storage/StoneFS/custom (sw_io_custom)
[Topic] HD720
[Plugin] Storage/StoneFS/HD720/HD720_Read_10Bit (HD720_Read_10Bit)
[Plugin] Storage/StoneFS/HD720/HD720_Read_12Bit (HD720_Read_12Bit)
[Plugin] Storage/StoneFS/HD720/HD720_Read_8Bit (HD720_Read_8Bit)
[Plugin] Storage/StoneFS/HD720/HD720_Write_10Bit (HD720_Write_10Bit)
[Plugin] Storage/StoneFS/HD720/HD720_Write_12Bit (HD720_Write_12Bit)
[Plugin] Storage/StoneFS/HD720/HD720_Write_8Bit (HD720_Write_8Bit)
[Topic] HDTV
[Plugin] Storage/StoneFS/HDTV/HDTV_Read_10Bit (HDTV_Read_10Bit)
[Plugin] Storage/StoneFS/HDTV/HDTV_Read_12Bit (HDTV_Read_12Bit)
[Plugin] Storage/StoneFS/HDTV/HDTV_Read_8Bit (HDTV_Read_8Bit)
[Plugin] Storage/StoneFS/HDTV/HDTV_Write_10Bit (HDTV_Write_10Bit)
[Plugin] Storage/StoneFS/HDTV/HDTV_Write_12Bit (HDTV_Write_12Bit)
[Plugin] Storage/StoneFS/HDTV/HDTV_Write_8Bit (HDTV_Write_8Bit)
[Topic] NTSC
[Plugin] Storage/StoneFS/NTSC/NTSC_Read_10Bit (NTSC_Read_10Bit)
[Plugin] Storage/StoneFS/NTSC/NTSC_Read_12Bit (NTSC_Read_12Bit)
[Plugin] Storage/StoneFS/NTSC/NTSC_Read_8Bit (NTSC_Read_8Bit)
[Plugin] Storage/StoneFS/NTSC/NTSC_Write_10Bit (NTSC_Write_10Bit)
[Plugin] Storage/StoneFS/NTSC/NTSC_Write_12Bit (NTSC_Write_12Bit)
[Plugin] Storage/StoneFS/NTSC/NTSC_Write_8Bit (NTSC_Write_8Bit)
[Topic] PAL
[Plugin] Storage/StoneFS/PAL/PAL_Read_10Bit (PAL_Read_10Bit)
[Plugin] Storage/StoneFS/PAL/PAL_Read_12Bit (PAL_Read_12Bit)
[Plugin] Storage/StoneFS/PAL/PAL_Read_8Bit (PAL_Read_8Bit)
[Plugin] Storage/StoneFS/PAL/PAL_Write_10Bit (PAL_Write_10Bit)
[Plugin] Storage/StoneFS/PAL/PAL_Write_12Bit (PAL_Write_12Bit)
[Plugin] Storage/StoneFS/PAL/PAL_Write_8Bit (PAL_Write_8Bit)
[Topic] Support
[Plugin] Support/checkLicenseFile (Check License File)
[Plugin] Support/ftpuploadlogs (Send Logs to Support)
[Topic] System
--- no plugins detected ---
[Topic] HW_plugins
[Plugin] System/HW_plugins/freeSpace (Disk(s) Free Space)
[Plugin] System/HW_plugins/getCpuInfoFromOS (CPU info (OS))
[Plugin] System/HW_plugins/getMachineInfo (Machine Info (fromBIOS))
[Plugin] System/HW_plugins/hinv (Hardware Inventory)
[Plugin] System/HW_plugins/listPciDevices (List PCI Devices)
[Plugin] System/HW_plugins/memInfo (Memory Information)
[Plugin] System/HW_plugins/USBinfo (USB Information)
[Topic] OS_plugins
[Plugin] System/OS_plugins/getModulesLoaded (Get Loaded Kernel Modules)
[Plugin] System/OS_plugins/getTopTasks (Top Tasks)
[Plugin] System/OS_plugins/getUptime (OS Uptime)
[Plugin] System/OS_plugins/Last (Last logged in users)
[Plugin] System/OS_plugins/listProcess (Running Processes)
[Plugin] System/OS_plugins/OS_Info (OS Information)
[Plugin] System/OS_plugins/runChkconfig (Check Config)
[Topic] Video
[Plugin] Video/videoIOSync (Video I/O Sync)
=============================[End List of Plugins]==============================

위의 내용처럼 확인해보면

SystemCentral 에서 사용가능한 Plugin list 가 나온다.

필요한 Plugin list 를 적용시켜보면

[root@aRTiSAn ~]# SystemCentral -x System/OS_plugins/runChkconfig,Configuration/run_dlConfigCheck -o file

위와 같이 SystemCentral 을 동작 시킬수 있으며 log 내용을 파일로도 저장이 가능하다.

[root@aRTiSAn ~]# ls -al /usr/discreet/SystemCentral/results/
?? 24drwxrwxrwx 2 root users 4096 2? 6 11:49 .
drwxr-xr-x 9 root root 4096 1? 21 23:08 ..
-rw-r--r-- 1 root root 8342 2? 6 11:49 result_2009-02-06_11:49:41.067092.txt

위의 경로에 log 내용이 저장 되는것을 확인할수 있다.

SystemCentral 이 적용된 최종 script 내용은 다음과 같다.


#!/bin/bash
DATE=`date +"%Y%m%d"`PREV_DATE=`date +"%Y%m%d" --date '3 days ago'`
PATH=/usr/local/bin
LOG_DIR=/backup/log
CFG_DIR=/backup/cfg
PROJECT_DIR=/backup/project
CLIP_DIR=/backup/clip
LICENSE_DIR=/backup/license
ARCHIVE_DIR=/backup/archive
SETTING_DIR=/backup/etc
SYSTEMCENTRAL_DIR=/backup/systemcentral
tar cvf ${LOG_DIR}/discreet_log_${DATE}.tar /usr/discreet/log /usr/discreet/sw/log
tar cvf ${CFG_DIR}/discreet_cfg_${DATE}.tar /usr/discreet/sw/cfg
tar cvf ${PROJECT_DIR}/discreet_project_${DATE}.tar /usr/discreet/project
tar cvf ${CLIP_DIR}/discreet_clip_${DATE}.tar /usr/discreet/clip
tar cvf ${LICENSE_DIR}/discreet_license_${DATE}.tar /usr/local/flexlm/licenses /usr/discreet/sparks
tar cvf ${ARCHIVE_DIR}/discreet_archive_${DATE}.tar /usr/discreet/archive
tar cvf ${SETTING_DIR}/setting_${DATE}.tar /etc
tar cvf ${SYSTEMCENTRAL_DIR}/systemcentral_${DATE}.tar /usr/discreet/SystemCentral/results
${PATH}/SystemCentral -x System/OS_plugins/runChkconfig,Configuration/run_dlConfigCheck -o file
rm ${LOG_DIR}/discreet_log_${PREV_DATE}.tar
rm ${CFG_DIR}/discreet_cfg_${PREV_DATE}.tar
rm ${PROJECT_DIR}/discreet_project_${PREV_DATE}.tar
rm ${CLIP_DIR}/discreet_clip_${PREV_DATE}.tar
rm ${LICENSE_DIR}/discreet_license_${PREV_DATE}.tar
rm ${ARCHIVE_DIR}/discreet_archive_${PREV_DATE}.tar
rm ${SETTING_DIR}/setting_${PREV_DATE}.tar
rm ${SYSTEMCENTRAL_DIR}/systemcentral_${PREV_DATE}.tar
rm /usr/discreet/SystemCentral/results/*
mutt -x -a ${SYSTEMCENTRAL_DIR}/systemcentral_${DATE}.tar -s "cl_post_flame_log" artisanm@gmail.com < /dev/null

라벨: , , , , ,


댓글: 댓글 쓰기

에 가입 댓글 [Atom]





<< 홈

This page is powered by Blogger. Isn't yours?

에 가입 덧글 [Atom]