在 CentOS 中查看 crontab(定时任务)通常有以下几种方式,根据你查看的是当前用户还是系统级任务来区分:
crontab -l
no crontab for user,说明该用户没有任务crontab -l -u username
例如:
crontab -l -u root
CentOS 中系统级的定时任务通常在以下目录:
ls -l /etc/crontab
cat /etc/crontab
ls -l /etc/cron.d/
cat /etc/cron.d/*
ls -l /etc/cron.hourly/
ls -l /etc/cron.daily/
ls -l /etc/cron.weekly/
ls -l /etc/cron.monthly/
systemctl status crond
或
service crond status
启动 / 重启 cron:
systemctl start crond
systemctl restart crond
CentOS 7+:
journalctl -u crond
或
grep CRON /var/log/cron
如果你愿意,可以告诉我:
我可以给你更精确的命令。