---
title: "CentOS下安装cron"
author: "ssxxjjii"
date: "2013-05-21T17:47:11Z"
tags: []
categories: ["互联网"]
slug: "centos-cron"
draft: false
lastmod: "2013-05-21T17:47:11Z"
id: 1872957
url: "https://tdcq.iteye.com/blog/1872957"
---

## CentOS下安装cron

 

今天到服务器上去添加cron任务时发现服务器竟然没有安装crond服务，在这里做一下安装和使用的记录。  
1、安装

1. yum install vixie-cron crontabs

2、开启

1. /sbin/chkconfig --level 35 crond on  # 开机自启动
2. /sbin/service crond start

3、添加任务

1. crontab -e

4、crontab 格式  
\* *　 *　 *　 *　command

第1列表示分钟 1～59 每分钟用 * 或者 \*/1 表示  
第2列表示小时 1～23（0表示0点）  
第3列表示日期 1～31  
第4列表示月份 1～12  
第5列标识星期 0～6 （0表示星期天）  
第6列要运行的命令