본문 바로가기
카테고리 없음

[Linux] crontab 관리

by james_janghun 2024. 11. 26.

우리가 주기적으로 무언가를 실행할 때 crontab을 통해서 설정한다.

 

crontab 설정에는 다음과 같이 두 가지 방법이 있다.

 

vi /etc/crontab

crontab -e

 

이 둘의 차이가 무엇인지 하나씩 알아보자.

 

vi /etc/crontab

이 곳에서는 시스템 배치 관리를 담당합니다.

배치를 실행할 사용자 계정을 반드시 명시해야합니다.

다음과 같이 /etc/crontab 안에는 hourly 등 다양한 파일이 존재해서 여기서 cron을 관리하게 됩니다.

 

https://fascination-euna.tistory.com/entry/Linux-CRON%EA%B3%BC-AT

 

systemctl restart crond

실행내역은 /var/log/cron에서 확인합니다.

 

 

crontab -e

crontab -e는 이것을 실행하는 사용자를 기본으로 깔고 설정하는 crontab입니다.

명령어에서 볼 수 있듯 crontab 명령어를 사용하는 것이기 때문에 사용자가 직접 배치관리하는 것입니다. 그렇기 때문에 사용자 지정이 불필요했습니다.

 

목록을 조회하려면

crontab -l을 사용하면 됩니다.

 

꿀팁 사이트

좋은 사이트가 많은데 첫번째와 두번째가 제일 쉽게 사용이 가능하다.

https://cronexpressiontogo.com/every-4-hours

 

Cron Expression To Go: Cron Expression Editor

 

cronexpressiontogo.com

https://crontab.guru/

 

Crontab.guru - The cron schedule expression generator

loading...

crontab.guru

http://www.cronmaker.com/;jsessionid=node0fcfmefdjsjxgj490yxtxvqlt1047457.node0?0

 

CronMaker

 

www.cronmaker.com

https://www.freeformatter.com/cron-expression-generator-quartz.html

 

Free Online Cron Expression Generator and Describer - FreeFormatter.com

 

www.freeformatter.com

 

 

 

 

참고

https://fascination-euna.tistory.com/entry/Linux-CRON%EA%B3%BC-AT