Centos 6.x crond (anacron) > 주인장(개발자) 로그 - [Unknown]

본문 바로가기
사이트 내 전체검색
google.com / youtube.com / naver.com / daum.net / zum.com


현재: 약 50만 다운로드 / 목표: 글로벌 5,000만 다운로드 이상
인기 국가: 한국,인도,미국,홍콩,오스트리아,일본,스위스
프랑스,캐나다,이탈리아,오스트레일리아,영국,스페인

회원로그인


이곳은 "개인 블로그"입니다.
::: 손님분들 환영 :::
콜린스코빌드 영영사전
캠브리지 영영사전
옥스포드 영영사전
메리엄웹스터 영영사전
롱맨 영영사전
특수문자
2024-04-25 (목)
03:06 KST / +09:00
Give First, and then ...

[ Android Application Links ]
Since 2011.03

ⓐ 정각알림(OnTimeAlarm)
ⓑ 알람포미(Alarm4Me)
ⓒ 플래시온(FlashOn)
ⓓ 와이파이온오프위젯
    (WifiOnOff4 Widget)

ⓔ 폴더플레이어포미
    (FolderPlayer4Me)

ⓕ 리코더포미(Recorder4Me)
ⓖ 리사이즈픽포미
    (ResizePic4Me)

ⓗ 언인스톨러포미
    (Uninstaller4Me)

ⓘ 배터리포미(Battery4Me)
ⓙ 볼륨맨포미
    (Volumeman4Me)

달러 환율보기
Your IP: 3.14.70.203

배너수익은 앱개발과 개선에 사용합니다.

※ 주인장의 개인 글쓰기 공간 

 

주인장(개발자) 로그

Linux | Centos 6.x crond (anacron)

페이지 정보

작성자 주인장 작성일2016. 06. 30. 00:56 조회23,487회 댓글0건

본문



배너수익은 앱개발과 개선에 사용합니다.

[Centos 6.x crond (anacron)]

 

[root@localhost ~]# yum install crontabs

 

[root@localhost ~]# cat /etc/crontab

SHELL=/bin/bash

PATH=/sbin:/bin:/usr/sbin:/usr/bin

MAILTO=root

HOME=/

 

# For details see man 4 crontabs

 

# Example of job definition:

# .---------------- minute (0 - 59)

# |  .------------- hour (0 - 23)

# |  |  .---------- day of month (1 - 31)

# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...

# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat

# |  |  |  |  |

# *  *  *  *  * user-name command to be executed

[root@localhost ~]#

 

[root@localhost ~]# ls -l /etc/cron.d

total 8

-rw-r--r--  1 root root 113 Nov 10  2015 0hourly

-rw-r--r--. 1 root root 108 Oct 11  2013 raid-check

[root@localhost ~]#

[root@localhost ~]# cat /etc/cron.d/0hourly
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
01 * * * * root run-parts /etc/cron.hourly
[root@localhost ~]#

[root@localhost ~]# ls -l /etc/cron.hourly/
total 8
-rwxr-xr-x  1 root root 409 Nov 10  2015 0anacron
-rwxr-xr-x. 1 root root 273 Nov 22  2013 mcelog.cron
[root@localhost ~]#

[root@localhost ~]# cat /etc/cron.hourly/0anacron
#!/bin/bash
# Skip excecution unless the date has changed from the previous run
if test -r /var/spool/anacron/cron.daily; then
    day=`cat /var/spool/anacron/cron.daily`
fi
if [ `date +%Y%m%d` = "$day" ]; then
    exit 0;
fi

# Skip excecution unless AC powered
if test -x /usr/bin/on_ac_power; then
    /usr/bin/on_ac_power &> /dev/null
    if test $? -eq 1; then
    exit 0
    fi
fi
/usr/sbin/anacron -s
[root@localhost ~]#

[root@localhost ~]# cat /etc/anacrontab
# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22

#period in days   delay in minutes   job-identifier   command
1       5       cron.daily              nice run-parts /etc/cron.daily
7       25      cron.weekly             nice run-parts /etc/cron.weekly
@monthly 45     cron.monthly            nice run-parts /etc/cron.monthly
[root@localhost ~]#

$–> Field 1 is Recurrence period: This is a numeric value that specifies the number of days.
1 – daily
7 – weekly
30 – monthly
N – This can be any numeric value. N indicates number of days
@monthly’ for a job that needs to be executed monthly.

$–> Field 2 is Delay: This indicates the delay in minutes. i.e X number of minutes anacron should wait before executing the job after the the machine starts.

$–> Field 3 is Job identifier: It is the name for the job’s timestamp file. It should be unique for each job. This will be available as a file under the /var/spool/anacron directory. This file will contain a single line that indicates the last time when this job was executed.

$–> Field 4 is command: Command or shell script that needs to be executed.

START_HOURS_RANGE :- Interval, when scheduled jobs can be run, in hours, In case the time interval is missed, for example due to a power failure, the scheduled jobs are not executed that day.

RANDOM_DELAY :- maximum number of minutes that will be added to the delay in minutes variable which is specified for each job, The minimum delay value is set, by default, to 6 minutes. If RANDOM_DELAY is, for example, set to 12, then between 6 and 12 minutes are added to the delay in minutes for each job in that particular anacrontab. RANDOM_DELAY can also be set to a value below 6, including 0. When set to 0, no random delay is added. This proves to be useful when, for example, more computers that share one network connection need to download the same data every day.

[anacron 은 왜 도입되었나?]
1) 작업이 시작되는 시간을 매번 0분~45분 지연시켜 다른 서버들과 동일한 시간에 스케쥴 작업이 실행되는 부담을 줄인다.

기존 cron 에서는 /etc/cron.daily 를 매일 새벽 4시 2분에 실행하는 것이 기본값이었다. 만약 이 상황에서 rdate로 시간동기화를 time.bora.net으로 하도록 해두었다면 time.bora.net으로 새벽 4시 2분에 수많은 서버에서 동시요청을 하기 때문에 거의 DDOS 공격에 해당하게 되어 제대로 접속이 어려울 수 있다. 시간 동기화 외에도 VM이나 공유 스토리지를 사용하는 경우에도 모든 장비가 동시간에 부하가 발생하는 작업을 처리하는 것은 매우 비효율적일 것이다.  이러한 문제를 해결하는데 도움이 된다.
0분~45분 지연 시간은 /etc/anacrontab  설정의 RANDOM_DELAY=45 항목을 통해 변경할 수 있다.

2) 서버의 정지/장애 등으로 인한 매일/매주/매월 자동 실행 작업의 누락 가능성을 줄여준다.
이 부분은 자동 스케쥴러가 다소 복잡한 환경에서 유리하며 보다 자세한 내용을 알고 싶으신 분들은 다음 블로그 글을 참고한다.


  • 페이스북으로 보내기
  • 트위터로 보내기
  • 구글플러스로 보내기

댓글목록

등록된 댓글이 없습니다.

주인장(개발자) 로그 목록

Total 221건 22 페이지
주인장(개발자) 로그 목록
번호 제목 글쓴이 날짜 조회
열람중 Linux Centos 6.x crond (anacron) 인기글

[Centos 6.x crond (...
주인장 06. 30 23488
10 Utils [SSH 클라이언트] iputty-0.63-prerelease3.zip 인기글첨부파일관련링크

[SSH 클라이언트]iputty-0.63-prerelease3
주인장 06. 29 15047
9 Talk 운동장 끝에서 끝까지 연결하는 무선 통신, 블루투스 5 인기글관련링크

블루투스 SIG가 차세대 블루투스 규격 '블루투스 5'를 공개했다. 블루투스(Bluetooth...
주인장 06. 29 15178
8 Talk 담배 끊기 인기글

최근 이빨이 너무 아팠다. 신경치료했다. 담배를 1주일 끊었다. 이제...
주인장 06. 29 14829
7 Talk 김현철 서울대 교수 "중산층 총체적 붕괴가 밀려온다" 인기글관련링크

독일처럼 통일밖에 없지만... 그 누구도 행동하지 않는다고...정치인들은 자신들의 기득권이 줄어들지도 모른다는 생각?...공...
주인장 06. 29 15282
6 Talk 키보드 미끄럼방지 고무패드 2개가 2500원. ㅠㅠ 인기글

헉. 소믹 키보드의 미끄럼방지 고무패드를 잃어버려서 보내달랬다가 착불 2500원 지불. ㅠㅠ ...
주인장 06. 28 21098
5 Talk 도서 - 주식회사 대한민국 - 헬조선에서 민란이 일어나지 않는 이유 인기글관련링크

오늘날의 규모있는 투자들은 엄밀히 말하면 은행 또는 국가에 빚을 엄청 많이 내어서 시작되는 것들이다. 즉, 주식회사 대한민국에서는 빚을 많이내서 일을...
주인장 06. 28 15021
4 Talk 인구수 - 중국, 인도, 미국, 일본, 한국 인기글

중국의 인구는 약 1,355,692,576명(2014) / 세계 1위입니다.인도의...
주인장 06. 26 21726
3 CSharp_UWP 시샵 네트워크 연결 상태(True/False) 체크 인기글

 bool isNetworkAvailable =     S...
주인장 06. 26 14782
2 Talk 브렉시트 인기글관련링크

브렉시트=====BRitain + EXIT : - BREXIT. 영국이 유럽연합에서 탈퇴할 수 있다는 데서 나온 말. 이런 ...
주인장 06. 24 18835
게시물 검색


접속자집계

오늘
329
어제
3,886
최대
8,785
전체
8,996,841
* LOG :: ① 배의 속력이나 항정(航程)을 재는 데 쓰는 항해 계기 ② 항해 일지나 항공 일지 :: From 2016. About me 상단으로
안드로이드 애플리케이션 테스트에 사용하고 있는 스마트폰들
Galaxy Folder2(Android 6.0), Galaxy S10+(Android 11), LG V50(Android 10), Galaxy S9+(Android 10), Redmi Note7(Android 9)
Galaxy S7(Android 8.0), Galaxy S5(Android 6.0), Nexus 5x(Android 8.1), G4(Android 7.0), Redmi 4 Prime(Android 6.0)
모바일 버전으로 보기