linux 配置定时任务crontab ,开机自启动

  1. 开机自启动2种方式:

    系统文件配置: /etc/rc.d/rc.local
    定时任务:crontab -e
         @reboot /opt/xx.sh

  2. 查看定时任务

    crontab -l
    crontab -e执行后编辑输入@reboot /opt/xx.sh,系统会自动就存放于/var/spool/cron/目录中,文件以用户名命名。
  3. service cron restart, 重启crontab定时任务
      
  4. 删除定时任务,全部

    crontab -r

  5. 其它定时任务配置,格式查看cat /etc/crontab
posted @ 2024-07-19 15:02  zmm521  阅读(1913)  评论(0)    收藏  举报