개발자의 끄적끄적

[linux] 리눅스(CentOS/우분투)에서 CRONTAB 설치 방법 본문

개발/linux

[linux] 리눅스(CentOS/우분투)에서 CRONTAB 설치 방법

효벨 2020. 6. 17. 02:00
728x90
반응형

[linux] 리눅스(CentOS/우분투)에서 CRONTAB 설치 방법

 

 

가장 대표적인 리눅스 배포판인 CentOS 및 우분투에서 CRONTAB 설치하는 방법을 알아 보겠습니다.

 

저도 가끔 다시 설치하려고 하면 정확한 패키지명을 cron이라고만 생각해서 설치를 시도해서~~

매번 검색하는 번거로움을 줄이고자 정리 해봅니다.

 

CentOS에서 CRONTAB 설치하기


yum -y install cronie명령어를 실행 합니다.

bash-4.2# yum -y install cronie

 

이 명령어를 실행하면 아래와 같이 CRONTAB설치가 시작됩니다.


Loaded plugins: ovl, priorities
Resolving Dependencies
--> Running transaction check
---> Package cronie.x86_64 0:1.4.4-15.8.amzn1 will be installed
--> Processing Dependency: dailyjobs for package: cronie-1.4.4-15.8.amzn1.x86_64
--> Processing Dependency: syslog for package: cronie-1.4.4-15.8.amzn1.x86_64
--> Running transaction check
---> Package cronie-anacron.x86_64 0:1.4.4-15.8.amzn1 will be installed
--> Processing Dependency: crontabs for package: cronie-anacron-1.4.4-15.8.amzn1.x86_64
---> Package rsyslog.x86_64 0:5.8.10-9.26.amzn1 will be installed
--> Processing Dependency: logrotate >= 3.5.2 for package: rsyslog-5.8.10-9.26.amzn1.x86_64
--> Running transaction check
---> Package crontabs.noarch 0:1.10-33.9.amzn1 will be installed
---> Package logrotate.x86_64 0:3.7.8-26.14.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================
 Package                                    Arch                               Version                                          Repository                             Size
============================================================================================================================================================================
Installing:
 cronie                                     x86_64                             1.4.4-15.8.amzn1                                 amzn-main                              90 k
Installing for dependencies:
 cronie-anacron                             x86_64                             1.4.4-15.8.amzn1                                 amzn-main                              32 k
 crontabs                                   noarch                             1.10-33.9.amzn1                                  amzn-main                              10 k
 logrotate                                  x86_64                             3.7.8-26.14.amzn1                                amzn-main                              62 k
 rsyslog                                    x86_64                             5.8.10-9.26.amzn1                                amzn-main                             774 k

Transaction Summary
============================================================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 968 k
Installed size: 2.4 M
Is this ok [y/d/N]: y
Downloading packages:
(1/5): cronie-anacron-1.4.4-15.8.amzn1.x86_64.rpm                                                                                                    |  32 kB  00:00:00     
(2/5): logrotate-3.7.8-26.14.amzn1.x86_64.rpm                                                                                                        |  62 kB  00:00:00     
(3/5): rsyslog-5.8.10-9.26.amzn1.x86_64.rpm                                                                                                          | 774 kB  00:00:00     
(4/5): cronie-1.4.4-15.8.amzn1.x86_64.rpm                                                                                                            |  90 kB  00:00:00     
(5/5): crontabs-1.10-33.9.amzn1.noarch.rpm                                                                                                           |  10 kB  00:00:00     
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                       888 kB/s | 968 kB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : logrotate-3.7.8-26.14.amzn1.x86_64                                                                                                                       1/5 
  Installing : rsyslog-5.8.10-9.26.amzn1.x86_64                                                                                                                         2/5 
  Installing : crontabs-1.10-33.9.amzn1.noarch                                                                                                                          3/5 
  Installing : cronie-anacron-1.4.4-15.8.amzn1.x86_64                                                                                                                   4/5 
  Installing : cronie-1.4.4-15.8.amzn1.x86_64                                                                                                                           5/5 
  Verifying  : logrotate-3.7.8-26.14.amzn1.x86_64                                                                                                                       1/5 
  Verifying  : cronie-1.4.4-15.8.amzn1.x86_64                                                                                                                           2/5 
  Verifying  : rsyslog-5.8.10-9.26.amzn1.x86_64                                                                                                                         3/5 
  Verifying  : crontabs-1.10-33.9.amzn1.noarch                                                                                                                          4/5 
  Verifying  : cronie-anacron-1.4.4-15.8.amzn1.x86_64                                                                                                                   5/5 

Installed:
  cronie.x86_64 0:1.4.4-15.8.amzn1                                                                                                                                          

Dependency Installed:
  cronie-anacron.x86_64 0:1.4.4-15.8.amzn1       crontabs.noarch 0:1.10-33.9.amzn1       logrotate.x86_64 0:3.7.8-26.14.amzn1       rsyslog.x86_64 0:5.8.10-9.26.amzn1      

Complete!
bash-4.2#

 

그 다음 service crond start로 크론 서비스를 실행 해 주시면 됩니다.


bash-4.2# service crond start

 

마지막으로 서버가 재시작 될 때, 자동으로 crond를 실행하기 위해서 /sbin/chkconfig --levels 235 crond on명령어로 서비스에 등록 해 줍니다.


bash-4.2# /sbin/chkconfig --levels 235 crond on

 

Ubuntu에서 CRONTAB 설치하기


yum -y install cron명령어를 실행 합니다.

bash-4.2# apt-get install -y cron

 

출처 : https://www.blueiblog.com/ko/forum/view.php?idx=81

반응형
Comments