Running timer as unit: run-r2f2f454d18944d79af858a4be4f48cd5.timer Will run service as unit: run-r2f2f454d18944d79af858a4be4f48cd5.service
如果测试 ok,把对应的 timer 和 service 从/run/systemd/transient/ move 到/etc/systemd/system 做持久化
Ipsum
2024-05-30 22:43:41 +08:00
最简单就是每分钟运行,然后脚本获取当前时间,分钟能被 7 整除就运行。否则就退出。如果是其他时间 60 能被 n 整除可以用*/n
dxdydz
2024-05-30 23:25:00 +08:00
我想了个双脚本思路,大致内容如下 script_a.sh: #!/bin/bash # 使用 at 命令在 7 分钟后执行脚本 b #run task echo "/path/to/script_b.sh" | at now + 7 minutes script_b.sh: #!/bin/bash # 使用 at 命令在 7 分钟后执行脚本 a #run task echo "/path/to/script_a.sh" | at now + 7 minutes