![cron 작업 - 다음 작업이 언제 실행될지 알아보기 위해 환경을 쿼리할 수 있습니까?](https://linux55.com/image/127717/cron%20%EC%9E%91%EC%97%85%20-%20%EB%8B%A4%EC%9D%8C%20%EC%9E%91%EC%97%85%EC%9D%B4%20%EC%96%B8%EC%A0%9C%20%EC%8B%A4%ED%96%89%EB%90%A0%EC%A7%80%20%EC%95%8C%EC%95%84%EB%B3%B4%EA%B8%B0%20%EC%9C%84%ED%95%B4%20%ED%99%98%EA%B2%BD%EC%9D%84%20%EC%BF%BC%EB%A6%AC%ED%95%A0%20%EC%88%98%20%EC%9E%88%EC%8A%B5%EB%8B%88%EA%B9%8C%3F.png)
다음 cron 작업이 언제 실행될지 bash 작업을 통해 알아낼 수 있는 방법이 있는지 궁금합니다. 누구든지 이런 것을 시도한 적이 있습니까?
인터넷 검색을 해보았지만 아직 아무것도 찾지 못했습니다.
감사해요.
편집 1
더 자세한 내용을 알고 싶습니다. crontab -l을 확인하면 다음 출력이 표시됩니다.
lab-1:/etc/crontabs# crontab -l
# do daily/weekly/monthly maintenance
# min hour day month weekday command
*/15 * * * * run-parts /etc/periodic/15min
0 * * * * run-parts /etc/periodic/hourly
0 2 * * * run-parts /etc/periodic/daily
0 3 * * 6 run-parts /etc/periodic/weekly
0 5 1 * * run-parts /etc/periodic/monthly
#Ansible: Run every minute
* * * * * run-parts /etc/periodic/1min
내가 알아야 할 것은 단지 15분 폴더가 "활성화"되어 있다는 것만이 아니라, 예를 들어 지금부터 3분 후에 15분 폴더에 있는 작업이 실행된다는 것을 알고 싶은 방법이 있다면.
이를 수행할 수 있는 방법이 있습니까?
답변1
필요한 기능이 정확히 수행되는지는 모르겠지만 crontab
파일을 영어로 번역할 수 있습니다. 확인해 보세요.crontab2영어
Usage:
% crontab2english [-f] files...
Or:
% cat files... | crontab2english
If you do just this:
% crontab2english
then it's the same as crontab -l | crontab2english
Example output:
% crontab2english | less
Setting env var MAILTO to [email protected]
Command: (line 2)
Run: /bin/csh -c 'perl ~/thang.pl | mail -s hujambo root'
At: 8:10am on the 15th of every month
Command: (line 5)
Run: df -k
At: 5:40am every day
Command: (line 7)
Run: ls -l /tmp
At: 6:50am every Monday
Or with the -f ("f" for filter) switch, it just adds comments
to the input file:
% crontab2english -f | less
# My happy crontab file
[email protected]
10 8 15 * * /bin/csh -c 'perl ~/thang.pl | mail -s hujambo root'
#> At: 8:10am on the 15th of every month
40 5 * * * df -k
#> At: 5:40am every day
50 6 * * 1 ls -l /tmp
#> At: 6:50am every Monday