Linux定时任务使用(cron)
一、为什么需要定时任务?这个其实是我在工作当中遇到的一个问题,我需要在非工作时间,比如晚上0点,自动执行一个脚本,来重启算法服务。这其实也是卡在一个其他客户不用上班的时间,工作时间点肯定就不能进行算法服务的重启操作了,这对于客户的损失是比较大的。因此,借此场景来学习Linux定时任务的设置。 Linux设置定时任务的好处如下: 设置自动化重复工作,解放双手 保障系统维护在非工作时间执行 确保关键任务按时完成,避免人为遗忘 二、核心工具:cron与atLinux系统提供了多种定时任务工具,其中最常用的有cron和at,此外还有batch、systemd-timer等工具。不过目前主要使用的是cron和at。因此,下面主要介绍这两个工具的使用。 2.1 cron:最常用的周期性定时任务系统什么是cron? cron是Linux系统中最经典、最常用的定时任务调度器,用于周期性执行命令或脚本。它通过crontab文件定义任务,由cron守护进程(crond)在后台持续运行并检查任务执行时间,其中系统级任务存储在/etc/crontab和/etc/...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick StartCreate a new post1hexo new "My New Post" More info: Writing Run server1hexo server More info: Server Generate static files1hexo generate More info: Generating Deploy to remote sites1hexo deploy More info: Deployment