crontab 为定时执行脚本命令,我学习这个的目的是为了定时执行校园网登录脚本,以防止服务器内网穿透掉线。
1. 编写联网脚本
2. 赋予脚本执行权限
3. 安装crond
yum install crontabs -y
systemctl enable crond #设为开机启动
systemctl start crond #启动crond服务
systemctl status crond #查看是否启动
4. 编译 配置文件
crontab -e
5. 重启crond
service crond restart
6. 其他命
cat /var/log/cron #查看执行日志文件
crontab -l #查看当前配置文件内容