linux下添加定时任务

修改crontab文件
vi /etc/crontab
添加一条
1 * * * * root cd /root && wget -O log_ip http://…. 2>&1
每小时的1分钟,执行命令
*/3 * * * * root …
以上是每3分钟执行一次
*/3 6-8 * * * root …
以上是每天的早上六点到八点之间,每隔3分钟执行一次

判断是否安装cron:
可以运行 crontab -l
如果提示没有此命令,则安装
apt install cron

Leave a comment

Your email address will not be published. Required fields are marked *