以特定的分钟间隔执行 Cron 作业
Cron job at specific interval of minutes
我需要 运行 在 linux 每天每隔 20 分钟执行一次 cron 作业。最重要的是,必须在第10分钟、第30分钟和第50分钟。
我想我需要 运行 3 个 cron 作业:
10 * * * * /path_to_script
30 * * * * /path_to_script
50 * * * * /path_to_script
是否可以使用单个 cron 作业来满足此要求?
使用 sleep(1200) 时间分隔符将所有脚本聚合为一个
#脚本
#!/bin/bash
./wayto/script1;
sleep(1200);
./wayto/script2;
sleep(1200)
./wayto/script3;
并通过 crontab -e 在 cron 中完成一项工作
10 * * * * /bin/bash /way/to/script
10,30,50 * * * * /path_to_script
或
10/20 * * * * /path_to_script
我需要 运行 在 linux 每天每隔 20 分钟执行一次 cron 作业。最重要的是,必须在第10分钟、第30分钟和第50分钟。 我想我需要 运行 3 个 cron 作业:
10 * * * * /path_to_script
30 * * * * /path_to_script
50 * * * * /path_to_script
是否可以使用单个 cron 作业来满足此要求?
使用 sleep(1200) 时间分隔符将所有脚本聚合为一个
#脚本
#!/bin/bash
./wayto/script1;
sleep(1200);
./wayto/script2;
sleep(1200)
./wayto/script3;
并通过 crontab -e 在 cron 中完成一项工作
10 * * * * /bin/bash /way/to/script
10,30,50 * * * * /path_to_script
或
10/20 * * * * /path_to_script