徒然日記

/etc/crontabとcrontab -eの書式の違い

crontab -eはそのユーザ権限で実行するので、ユーザ権限に関する記述はいらない。

crontab -eの書式例
05 09 * * * /usr/local/hoge/hoge.sh > /dev/null

一方/etc/crontabは大元のcron設定なので、どのユーザ権限で実行するかを記述しなくてはならない。

/etc/crontabの書式例
05 09 * * * root /usr/local/hoge/hoge.sh > /dev/null