리눅스 1회성 예약작업 at, atd

Jmnote (토론 | 기여)님의 2014년 5월 22일 (목) 04:10 판 (→‎같이 보기)

at
/usr/bin/at
atd
/usr/sbin/atd
앳데몬, 앳D

1 at

  • 지정한 명령어를 지정한 시각에 1회 실행하도록 하는 리눅스 명령어
  • 시간이 되면 수행되고 목록에서 사라진다.
  • 예약작업 목록 확인 명령어
atq
at -l
  • 예약작업 취소 명령어
atrm 번호
at -d 번호
at -r 번호
  • /etc/at.deny 에 계정을 추가하여 at 사용을 금지시킬 수 있다.
/etc/at.allow 파일을 만들면 그곳에 기록된 사용자 외에는 모두 금지된다.[1]

2 atd

  • at 수행을 위한 데몬
[root@jmnote ~]# service atd status
atd (pid  2205) is running...

3 실습

[root@jmnote ~]# ll /root/hello.txt
ls: /root/hello.txt: No such file or directory
[root@jmnote ~]# date
Thu Feb 13 23:27:03 KST 2014
[root@svn0 ~]# echo "echo hello > /root/hello.txt" | at 2330 feb 13
job 3 at 2014-02-13 23:30
Can't open /var/run/atd.pid to signal atd. No atd running?
→ 3번 작업으로 등록됨. 그런데 atd가 작동중이 아님
[root@jmnote ~]# atq
3	2014-02-13 23:30 a root
[root@jmnote ~]# service atd start
Starting atd:                                              [  OK  ]
→ atd가 작동중이어야 atq 예약작업이 수행된다.
[root@jmnote ~]# date
Thu Feb 13 23:31:53 KST 2014
[root@jmnote ~]# atq
[root@jmnote ~]# ll /root/hello.txt
-rw-r--r-- 1 root root 6 Feb 13 23:30 /root/hello.txt
→ 23:30에 hello.txt 생성됨. atq 목록에서 사라짐[2]

4 같이 보기

5 주석

  1. 단, root는 무조건 허용됨
  2. atd가 작동중이 아니라면 예약작업이 수행되지 않으며, atq 목록에 계속 남아있게 된다.

6 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}