본문 바로가기
OS-OE Knowledge/Linux-Unix KB

RHEL/cron Job을 통해 반복적으로 작업 수행

by 스쳐가는인연 2019. 5. 21.

e.g.) IO workload

 

1. Create Job - 1G file create 100ea per every 20 mins / then remove it.

# crontab -u root crontab

# crontab -e
*/20 * * * * for i in {1..100}; do dd if=/dev/zero of=/tmp/dummy1G-$i bs=1 count=0 seek=1G; done
*/20 * * * * rm -f /tmp/dummy1G-*

 

2. List current cron job

# crontab -l

 

3. Remove cron job

# crontab -r

 

4. Repeat per second

* * * * * * <%command%> & sleep 30; <%command%>

 

5. restart cron daemon

service crond restart

 

cf. 

1 * * * *, not per every minute, it means every hours 1st minute. 1:01, 2:01, ...

* * * * *, execute per every minute.

* 1 * * *, not every hours, it means every days 1 o'clock.

01 * * * *, execute per every hour

 

 

참조.

https://greenhappy.tistory.com/entry/%EB%A6%AC%EB%88%85%EC%8A%A4-crontab-%EC%B4%88%EB%8B%A8%EC%9C%84-%EC%8B%A4%ED%96%89-%ED%95%98%EA%B8%B0

 

https://zetawiki.com/wiki/%ED%81%AC%EB%A1%A0%ED%83%AD_%EC%9E%91%EC%97%85_5%EB%B6%84%EB%A7%88%EB%8B%A4_%EC%88%98%ED%96%89

 

https://soooprmx.com/archives/6786

반응형