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

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


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

회원로그인


이곳은 "개인 블로그"입니다.
::: 손님분들 환영 :::
콜린스코빌드 영영사전
캠브리지 영영사전
옥스포드 영영사전
메리엄웹스터 영영사전
롱맨 영영사전
특수문자
2024-03-29 (금)
00:02 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: 44.221.43.88

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

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

 

주인장(개발자) 로그

Linux | Centos 6.x crond (anacron)

페이지 정보

작성자 주인장 작성일2016. 06. 30. 00:56 조회23,204회 댓글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건 20 페이지
주인장(개발자) 로그 목록
번호 제목 글쓴이 날짜 조회
31 채근담 채근담 전집11 인기글

채근담 전집11 명이주국으로 입맛을 달래고 비름나물로 창자를 채우는 사람 중에는 얼음처럼 맑고 옥처럼 깨끗한 사람이 많지만,...
주인장 07. 09 18179
30 채근담 채근담 전집10 인기글

채근담 전집10 원래 은총 속에서 재앙은 싹트게 된다. 그러므로 마음에 흡족할 때 모름지기 빨리 머리를 돌려 살펴야 한다. ...
주인장 07. 09 18482
29 채근담 채근담 전집9 인기글

채근담 전집9 밤이 깊어 인기척이 없이 고요할 때에 홀로 앉아 자신의 마음을 살펴보면, 비로소 망상이 사라지고 참마음이 나타...
주인장 07. 09 17169
28 채근담 채근담 전집8 인기글

채근담 전집8 하늘과 땅은 고요하여 움직이지 않지만 그 작용에는 잠시의 휴식이 없고, 해와 달은 밤낮으로 달리고 있지만 그 ...
주인장 07. 09 18634
27 채근담 채근담 전집7 인기글

채근담 전집7 농도 짙은 술, 기름진 고기와 맵고 단맛이 참다운 맛은 아니다. 참다운 맛은 오로지 담백할 뿐이다. 기이한 재...
주인장 07. 09 18160
26 채근담 채근담 전집56 인기글

채근담 전집6 거센 비바람에는 새들도 근심하고, 갠 날씨와 산들바람에는 초목도 기뻐하는 듯하다. 천지에는 하루라도 온화한 기...
주인장 07. 09 17786
25 채근담 채근담 전집5 인기글

채근담 전집5 귀에는 언제나 거슬리는 말을 듣고, 마음속에는 언제나 어긋나는 일이 있으면 이것은 곧 덕성을 기르고 행실을 닦...
주인장 07. 09 19127
24 채근담 채근담 전집4 인기글

채근담 전집4 권세와 명리, 사치와 호화로움을 가까이 하지 않는 사람을 결백하다고 하지만, 이를 가까이 하면서도 물들지 않은...
주인장 07. 09 21310
23 채근담 채근담 전집3 인기글

채근담 전집3 군자의 마음가짐은 푸른 하늘의 빛나는 태양처럼 남들로 하여금 모두 알아보게 해야 하며, 군자의 재능과 슬기로움...
주인장 07. 09 16501
22 채근담 채근담 전집2 인기글

채근담 전집2 세상과의 접촉이 얕으면 그만큼 때 묻음도 얕고, 세상과의 접촉이 깊으면 그만큼 남을 속이는 계략도 깊게 마련이...
주인장 07. 09 23321
게시물 검색


접속자집계

오늘
19
어제
3,730
최대
8,785
전체
8,894,302
* 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)
모바일 버전으로 보기