📜  crontab 执行 shell 脚本 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:14.390000             🧑  作者: Mango

代码示例1
# Script musts start with:
#!/bin/sh
# Allow execute grant on it
chmod +x /bin/sh/myscript.sh
# Edit crontab:
crontab -e                            # open user crontab in edit mode
i                                      # for insert.  Make your changes
0 2 * * * /bin/sh myscript.sh         # plan it daily at 2am for example
:wq!                                   # quit and save