2011.08.21 00:06

centos 자동 백업설정

조회 수 45694 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

1. cron 을 이용한 자동 백업 자료 생성

 

--------------- 웹서버의 자동 실행할 스크립트 작성 -------------

/root아래에 backup.sh 이라는 파일을 만들어 놓고 백업 명령어를 다음과 같이 주었다.

 

#!/bin/bash

/usr/local/mysql/bin/mysqldump -uroot -p***** mysql > mysql_db_bak_$(date +%Y%m%d).sql

/usr/local/mysql/bin/mysqldump -uyanemone -p***** yanemone > yanemone_db_bak_$(date +%Y%m%d).sql

mv *.sql /backup

tar cvfpz /backup/html_bak.tar.gz /var/www/html

tar cvfpz /backup/yanemone_html_bak.tar.gz /home/yanemone/public_html

tar cvfpz /backup/dichang_html_bak.tar.gz /home/dichang/public_html

 

find /backup -ctime +3 -exec rm -f {} ;

 

백업할 내용이라던지 파일 이름은 자신의 상황에 맞게 주면 되겠다.

그리고 finde...이 내용은 파일을 생성한지 3일이 지난 것을 찾아서 지우라는 것이다. 자꾸 만들면 용량을 차지하니까.. -_-

 

이렇게 하고 나면 backup.sh파일을 chmod 100 backup.sh로 단단히 무장하라.

 

그리고 crontab -e 명령으로 cron 작업을 명시하자

그럼 vi가 열리면서 편집이 가능하다

 

00 06 * * * /root/backup.sh

 

를 추가하고 :x 로 저장하고 나오자.

위의 작업은 매일 새벽 6시에 /root/backup.sh을 실행하라 라는 말이다.

 

그리고 /var/spool/cron/root가 있는지 확인해보자. 있다면 정상적으로 수행할 것이다.

?

List of Articles
번호 제목 날짜 조회 수
64 #1040 - Too many connections // XE cannot connect to DB. 이런 에러 나올때 #1040 - Too many connections XE cannot connect to DB. 이런 에러 나올때 mysql 에서 max_connection 제한때문에 일어나는 에러 현재 msyql max_connetion 확인 #mysqladmin -u root -p variables | grep max_conne... 2013.11.20 36207
63 #145 - Table './DB/xe_documents' is marked as crashed and should be repaired phpmyadmin 에서 #145 - Table './DB/xe_documents' is marked as crashed and should be repaired centos mysqld.log 에서 [ERROR] /usr/local/mysql/libexec/mysqld: Table './DB/xe_documents' is marked as crash... file 2014.06.22 16959
62 (Owncloud) Error while trying to create admin user: An exception occured in driver: could not find driver 에러 해결 (Owncloud) Error while trying to create admin user: An exception occured in driver: could not find driver 에러 해결 php 확장 모듈에서 php_pdo_mysql.dll 추가 해 주면 됩니다. 테스트 환경 windows7 // auto... 2015.02.19 4096
61 1267 : Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' 에러명 select count(*) as cnt from g4_point where mb_id = 'admin' and po_rel_table = '01_1' and po_rel_id = '1' and po_rel_action = '쓰기' 1267 : Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (u... 2012.02.21 93023
60 ajaxplorer 서버세팅 http://jekyung.com/139 2011.06.05 32238
59 apache2 재시작, 도메인 변경 방법 환경설정 vi /usr/local/apache2/conf/httpd.conf 도메인 수정 vi /usr/local/apache2/conf/extra/httpd-vhsots.conf 아파치 재실행 /usr/local/apache2/bin/apachestl restart 2013.07.01 30691
58 apm 버전 확인 명령어 rpm -qa | grep httpd rpm -qa | grep mysqld rpm -qa | grep php 2011.04.16 46746
57 apm 설치 yum 이용 1. APM(Apache + Php + Mysql) 설치 apache, mysql, php순으로 APM을 설치합니다. # yum -y install httpd # yum -y install mysql # yum -y install php 2. APM 관련 라이브러리 설치 # yum -y install gd gd-devel ... 2011.04.16 43681
56 autoset6 db 복원 import 시작 > 실행 > cmd 실행 cd autoset6servermysqlbin 이동후 c:autoset6servermysqlbin > 밑에 db 복원문 입력 mysql -u root(계정) -p jaggoowa(DB명) < /home/test/public_html/test.sql jaggoowa 라는 DB에 test.sq... 2011.07.16 42148
55 Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly. Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly. 이런 에러 나올때 php.ini 파일을 연다 파일을 못찾을 경... 2011.07.24 34026
54 cband-status 자정 초기화 하기 vi /home/cband-reset.sh #!/bin/bash wget --http-user=아이디 --http-passwd=패스워드 'http://www.싸이트이름.com/cband-status?reset=all&refresh=15&unit=' 라는 스크립트를 만들어 줍니다. 여... 2016.02.20 67161
53 cband-status 페이지 암호화 하기 yum 으로 httpd 설치한 환경 입니다. vi /etc/httpd/conf/httpd.conf 에서 다음과 같이 수정해 줍니다. <IfModule mod_cband.c> <Location /cband-status> SetHandler cband-status AuthType Basic AuthName User Aut... 2016.02.20 2524
52 centos 7 apm + vsftpd 설치 스크립트 쉘(shell) 스크립트 다운로드 주소 : http://wooriagi.pe.hu/install.sh 웹기본 폴더는 /var/www/html 입니다. 그리고 /etc/httpd/conf/httpd.conf 에서 AllowOverride None 이 부분을 찾아 AllowOverride ALL로 바... file 2015.12.05 2912
51 centos eaccelerator 설치 방법 설치 소스 압축풀고 디렉토리로 이동해서 phpize ./configure make make install php.ini 설정 추가(eaccelerator.so 파일의 경로가 맞도록) extension="eaccelerator.so" eaccelerator.shm_size="16" eaccelerator.c... file 2012.01.04 42324
50 centos mysql-bin.000001 파일 용량 줄이기 명령어를 통해 mysql-bin.000001 와 같은 파일이 있는 곳으로 이동 합니다. cd /var/lib/mysql 이동을 하고 다음 명령어 입력 ls mysql-bin.* 그럼 bin 파일들이 나옵니다. 파일이 많으면 그만큼 용량이 차지 하기에 ... 2015.01.01 6064
49 CentOS RPM 버전 확인 명령어 rpm -qa httpd //버전 확인 rpm -qi httpd //더 상세한 패키지 정보 rpm -qa php rpm -qa mysql 2012.05.09 46453
48 centos ZendOptimizer 설치 방법 적당한 위치에서 압축을 풉니다 # tar zxvf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz 3.3.9 버전부터는 이전버전의 install.sh 이 제공 되지 않습니다 일단 설치된 php버전을 확인합니다 # php -v PHP 5.2.... file 2012.01.04 42916
47 CentOS 버전 확인 lsb_release -a CentOS 버전 확인 lsb_release -a 혹은 다음 파일 중 하나를 열어 확인할 수 있다. /etc/issue /etc/redhat-release 2012.05.09 77101
46 centos 서버재시작 shoutdown -r now (1)shutdown shutdown 명령어는 시스템을 종료하거나 재부팅할 때 사용된다. 사용법 shutdown [옵션] [시간] [메세지] 옵션 -t n: 경고 메시지를 보낸 후 n초 후에 kill 시그널을 보낸다. -h : shutdown시 halt를 실... 2012.01.02 46951
45 Centos 설치방법 http://kch1183.blog.me/50099487610 추가, 파티션 나눌때 swap (가상메모리) 램 용량의 x 2 예) ram 2g , swap 4g 2011.04.16 31114
Board Pagination Prev 1 2 3 4 Next
/ 4