MongoDB - 运行 带有 Crontab 的脚本

MongoDB - Run script with Crontab

我有一个脚本我想每天更新。所以我必须使用一个crontab。如何使用 Crontab 运行 脚本?

更新

我用 ubuntu.

script file

假设您想每天在 12:15am 使用 bash 脚本进行更新。 然后像这样在 /etc/crontab 中添加一个条目

15 0 * * * /home/your_bash_script.sh

仅供参考,cron 中的时间条目添加为

* * * * * * <your-bash-script-path>
| | | | | | 
| | | | | +-- Year              (range: 1900-3000)
| | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
| | | +------ Month of the Year (range: 1-12)
| | +-------- Day of the Month  (range: 1-31)
| +---------- Hour              (range: 0-23)
+------------ Minute            (range: 0-59)