Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 shell 中的 crontable 有问题我总是这样写 cronjob
0 * * * * /tmp/myscript
但现在我在不同的外壳上并使用我的脚本我需要这样写
bash-4.2$ bash /tmp/myscript
这就是问题,因为当我这样写 cronjob
* * * * * /tmp/myscript or bash /tmp/myscript ---> thats not work
如何解决这个问题呢?
您必须对 Crontab 使用此结构:
* * * * * user-name command to be executed
顺便说一句,首先,您应该将 myscript 重命名为 myscript.sh 并运行它。
例如:
17 * * * * root bash /tmp/myscript.sh