crontab 常用操作

查看日志

查看日志:tail -n 10 /var/log/cron  (需要root权限)

crontab -l 查看个人用户有哪些crontab任务

crontab -e 添加个人用户crontab任务

定时任务还有一种写在/etc/crontab文件中的方式,但是在centos7中写在该文件中执行会报错

[oracle@node2 ~]$ 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
[oracle@node2 ~]$ 

猜你喜欢

转载自blog.csdn.net/sinat_41780498/article/details/85693356