CentOS 定時任務文件保存及查看地方

1、建立一個任務文件


(1)命令行輸入crontab -ecentos

crontab -e

(2)輸入a或者i能夠進入編輯狀態,可輸入任務代碼。代碼格式能夠進入/etc/crontab查看bash

[root@VM-0-10-centos cron]# cat /etc/crontab

# 輸出結果
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed

2、保存文件


先按Esc鍵,而後輸入「:wq」命令行

3、查看文件

保存成功的文件去哪裏了呢?在/var/spool/cron/下面code

[root@VM-0-10-centos cron]# cd /var/spool/cron
[root@VM-0-10-centos cron]# ll
total 4
-rw------- 1 root root 176 May 19 14:17 root
這裏能夠看到一個root文件,由於我用的root帳號登陸,因此生成了一個root文件。 經過cat命令能夠看到這個文件的內容就是前面編輯的內容。
相關文章
相關標籤/搜索