一、cron定时任务
服务端:cron 后台运行
客户端:crontab 配置工具
1.运行
服务端
[root@oldboy data]# systemctl status crond
● crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
Active: active (running) ##代表运行
systemctl start crond #启动
systemctl enable crond #开机自启动
客户端:crontab 配置工具
crontab -l 查看定时任务
crontab -e 编辑定时任务
语法:
* * * * * 任务
分 时 日 月 周
范围:
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .--