linux定时任务配置

1.查看是否安装了crontab

service crond status

2.创建要定时执行的脚本test.sh(注:所有的路径都写绝对路径,包括输出日志的路径,否则执行可能会有问题)

#!/bin/bash
echo "大家好" >> /home/kavins.logecho "执行时间为:`date`">>/home/kavins.log

3.配置定时任务: crontab -e

*/1 * * * * sh /home/aaa.sh >> /home/test.sh
* * * * * command
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)

 

posted @ 2024-04-22 18:42  Kavins  阅读(1)  评论(0编辑  收藏  举报