You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
将以下代码复制到你面板的定时任务那里,选择shell Scrip。
如果你是docker部署的:
首先需要进入已经运行的Docker容器,在终端中输入以下命令:
1.创建定时任务脚本
在容器内创建用于运行定时任务的脚本文件,可以使用vi等编辑器创建和编辑,填写如下代码并保存。
可以将文件保存为xxxx.sh,“xxxx”是名称,自行命名。
2.设定定时任务
使用crontab命令设定定时任务,运行以下命令:
然后在打开的文件中添加以下内容保存并退出:
上述代码表示每天午夜2点会执行脚本(很多小伙伴是夜猫子,我想2点一般都休息了吧,你也可以根据你自己的需求来改,“0 2 * * *”中的2是小时,前面的0是分钟,例如2:35,就可以改成“35 2 * * *”即可),并将输出结果添加到/var/log/cron.log文件中。
Beta Was this translation helpful? Give feedback.
All reactions