最近有个问题困扰我.
crontab 执行脚本生成文件都是root 用户.
web 写文件 apache 用户 造成apache 和root 同时写一份日志 apache 权限不足!!
解决方案 :
vim /etc/crontab * * * * * user-name command to be executed
|
SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/
# For details see man 4 crontabs
# Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed
#OTC每分钟检测订单更新订单状态 */1 * * * * apache /usr/bin/php /home/index.php Crontab autoUpdateOrderStatusCrontab >> /tmp/autoUpdateOrderStatusCrontab.log 2>&1
|