Linux Cron 脚本权限

通常,应该执行的脚本也需要标记为可执行,这也适用于由 cron 调用的脚本。
除此之外,特定要求适用于位于 Debian 特定调度文件夹中的脚本。

为了让运行部分执行位于 cron 调度文件夹内的 cron 脚本,它们需要由 root 拥有,并且也不能由 group 或者 other 写入。
这些脚本的文件名也可能不包含点 (.) 字符。

这些限制适用于位于 Debian 和 Ubuntu 特定文件夹中的脚本:

  • /etc/cron.monthly
  • /etc/cron.weekly
  • /etc/cron.daily
  • /etc/cron.hourly

要制作一个应该由 cron 可执行文件运行的脚本:

sudo chmod +x /path/to/script-file.sh

请记住,放置在这些文件夹中的文件的名称中不能包含点字符。
唯一允许的字符是字母数字、连字符和下划线:[a-zA-Z0-9_-]。

日期:2020-06-02 22:16:49 来源:oir作者:oir