Apart from video games one of the great advantages of using computers is that they don’t seem to mind doing boring and repetitive tasks that we would rather not do. 떨어져 컴퓨터를 사용하여 비디오 게임의 큰 장점 중 하나에서 우리는 절대로하지 않는 것이 오히려 지루해하고 반복적인 작업을하고 마음에 보이진 않네요. For monotonous tasks such as running daily backups we are better off scheduling them to run at a certain time every day, and do more interesting stuff with our time. 그런 그들에게 우리도 휴가 일정을 매일 특정 시간에 실행되도록 백업을 실행으로 단조로운 일상이 더 나은 작업을, 그리고 우리의 시간을 함께 할 더 많은 흥미 롭 더군요. Linux and UNIX usually come with the utility “crontab” by default. 리눅스와 유닉스 유틸리티는 대개 "crontab을 가진"기본에 들르게. This very useful command allows you to schedule tasks to run at a specified time and repeat as configured. 이것은 매우 유용한 명령은 지정된 시간과 구성으로 반복 실행하도록 작업을 예약할 수있습니다. A task scheduled using “crontab” is called a “cron job”. 작업 "" "cron 작업이라고합니다"crontab을 사용 예정이다.
The crontab command allows you to instruct your server to execute a script at a specified minute of the specified day of the particular month. 이 crontab을 명령하면 하루 중 특정 달의 지정된 시간에 지정된 스크립트를 실행하려면 서버를 지시할 수있습니다. To see what cron jobs are setup to run on your machine, run the following command: 일자리를 cron 컴퓨터에 실행하도록 설정,이 무엇인지 확인하려면 다음 명령을 실행합니다 :
# crontab -l # crontab을 - 난
If your machine has some cron jobs configured it will display something like the following: 일부 컴퓨터에는 cron 작업을하고있다면, 그것은 다음과 같은 뭔가가 표시됩니다 구성 :
0 6 * * * /opt/scripts/backup_script.sh 0 6 * * * / 수신 거부 / 스크립트 / backup_script.sh
The crontab configuration above shows a cron job that executes the shell script “backup_script” everyday at 6 AM. 위의 crontab을 구성 6 일 오전 2시 셸 스크립트 "backup_script"매일 실행 cron 작업을 보여줍니다. The * means to run at every instance of the value in the field. * 분야에서 가치의 모든 인스턴스에서 실행하는 것을 뜻합니다. So an asterisk in the day, month, and day of week fields in the above example means that the script should run every day of the month, every month of the year, and every day of the week. 위의 예제에서 하루, 일주일에 필드에 별표를 달, 하루 그래서 하루는 그 스크립트를 매월 실행한다는 뜻, 올해의 매달, 매주 하루. The first and second fields tell crontab to execute the script at zero minutes and six hours, which is 6 AM. 첫 번째와 두 번째 필드는 오전 6시입니다 0 분, 6 시간에서 스크립트를 실행하는 crontab을 말해. So, this cron job configuration would read something like this, “Run the script /opt/scripts/backup_script.sh at zero minutes, 6 AM, every day, every month, and every day of the week.” Below is the “anatomy” of a crontab configuration explained. 그래서,이 cron 작업 구성, "실행 스크립트 / 0 분, 6 일 오전 매일 주, 매 달, 그리고 매일 / 스크립트 / backup_script.sh 제외이 같은 것을 읽을 것이다."아래 "해부학입니다 "crontab을 구성의 설명이다.
0 6 * * * /opt/scripts/backup_script.sh 0 6 * * * / 수신 거부 / 스크립트 / backup_script.sh
| | | | | | | | | |
| | | | |________________ day of week (Sunday=0) | 주 | | | |________________ 매일 (일요일 = 0)
| | | |__________________ month of year | | | |__________________ 올해의 달
| | |____________________ day of month | 달 | |____________________ 하루
| |______________________ hour of day | |______________________ 하루의 시간
|________________________ minute of hour |________________________ 시간 분
To schedule new cron jobs or to edit old ones execute the following command: 또는 새로운에는 cron 작업을 예약하려면, 이전의 것들을 수정하려면 다음 명령을 실행 :
# crontab -e # crontab을 - e로
This will bring up an editor with which you can add, edit, or delete “cron jobs”. 이 "당신, 추가, 수정 또는"cron이 일자리를 삭제 편집기가 나타납니다. To schedule a job to run at 3:45 PM every Monday add entry like this: 월요일 오후 3시 45분에서 실행할 수있는 모든 일을 스케줄이 같은 항목을 추가하려면 :
45 15 * * 1 /opt/scripts/script.sh 45 15 * * 1 / 수신 거부 / 스크립트 / script.sh
You can also use a comma to add multiple entries into a field. 또한 필드에 여러 항목을 추가하려면 쉼표를 사용할 수있습니다. This is useful if you want to run a script thrice a day, with an eight hour interval. 만약 당신이 하루에 몇 번이고 스크립트를 실행하려면이, 8시간 간격 유용합니다. Make sure you do not leave space between entries in a single field, though. 확실 항목 사이에 하나의 필드에, 비록 공간을 떠나지 말아요. Your “cron job” entry would look like this: "cron 작업"항목이처럼 보일 것 :
0 1,9,17 * 2,11 * /opt/scripts/db_backup_script.sh 0 1,9,17 * 2,11 * / 수신 거부 / 스크립트 / db_backup_script.sh
In the above example the script “db_backup_script.sh” runs at 1 AM, 9 AM, and 5 PM every day in the months of February and November. 스크립트 "db_backup_script.sh"새벽 1 시까지, 9 일 오전 5시 매일 2 월 및 11 개월에서 실행 위의 예에서. There are a lot of cool things that you can do with cron jobs. 거기에는 cron 작업을 함께 할 수있는 멋진 것들도 많다. The same works for day, month, and day of week. 하루, 같은 작품을 달, 요일. Once you get the hang of this try out the following. 일단 당신이 다음 밖으로 걸어보십시오. Crontab doesn’t only understand numbers, it can also operate on some basic English words: crontab을 숫자로만 이해하지 못하고, 그것도 몇 가지 기본적인 영어 단어를 운영할 수있습니다 :
string explanation 문자열 설명
—— ———– - ----
@reboot Run once, the next time the system reboots @ 재부 팅을 실행되면, 다음 시간에 시스템을 재부 팅
@yearly Run once a year, at the beginning of the year @ 매년 일년에 한 번 실행, 올해의 시작
@annually Same as @yearly, run once annually 매년 연간 @ @로, 매년 한 번 실행 동일
@monthly Run once a month, at the beginning of the month @ 월별 실행을 한 달에 한 번, 한달의 시작
@weekly Run once a week, at the beginning of the week @ 매주 일주일에 한 번씩 실행, 일주일의 시작
@daily Run once a day, at midnight 자정 @ 매일 하루에 한 번 실행,
@midnight Same as @daily, run at midnight 매일 자정 @ @로, 자정에 실행 같은
@hourly Run once an hour, at the beginning of the hour @ 시간별 실행을 한 번 한 시간, 시간의 시작
So, for example, if you want to run a script at midnight every night, this is what your crontab configuration would look like: 따라서, 예를 들면, 만약 당신이 매일 밤 자정에서 스크립트를 실행하려면이 귀하의 crontab을 구성하려는 모양입니다 :
@midnight /opt/scripts/script.sh @ 자정 / 수신 거부 / 스크립트 / script.sh
Using “@midnight” rather than “0 0 * * *” will work the same and execute the requested script at midnight every night while being a lot more readable than its numerical counterpart. "자정 @"대신 "보다 0 0 * * *"를 사용하여 같은 일을하고 매일 밤 자정에 요청된 스크립트를 실행하는 동안보다 더 많은 국가의 숫자를 읽을 수있다. You can also make the use of hyphens to declare a range. 또한, 하이픈의 사용 범위를 선언을 할 수있습니다. In the command below “script.sh” will be executed at the beginning of every hour from 1 AM to 6 AM: "script.sh"아래의 명령에서 새벽 1 시까지에서 매 시간의 시작에서 6 오전 실행된다 :
0 1-6 * * * /opt/scripts/script.sh 0 1-6 * * * / 수신 거부 / 스크립트 / script.sh
There are many more cool things you can do with cron. 거기에는 cron과 함께 할 수있는 더 많은 멋진 일들입니다. Every sysasmin swears by it, it’s pretty easy to use once you get the hang on it, and very powerful. 묘리를 터득하면 그것에 대한 모든 sysasmin 그것으로 맹세, 아주 사용하기 위해서는 매우 강력한 쉽습니다. Use this tool wisely, as scheduling a task wrongly can sometimes do a lot of harm. 현명하게, 때로는 손해의 잘못을 많이 할 수있는 작업 스케줄링으로이 도구를 사용합니다. Reading the “man page” of crontab would be highly recommended. crontab을의 "인간 페이지"레딩이 높은 것이 좋습니다.






















{ 0 comments… (0 코멘트 ... add one now 지금 하나 추가 } )
Leave a Comment 코멘트를 남겨주세요