开发者

Permissions error after clearing cache via CRON

开发者 https://www.devze.com 2023-03-04 13:20 出处:网络
I have an app running in production on nginx/passenger. Due to some issues I had to set up a CRON for weekly cache clearing. Now every Monday after it clears the cache the app stops working wi开发者_如

I have an app running in production on nginx/passenger. Due to some issues I had to set up a CRON for weekly cache clearing. Now every Monday after it clears the cache the app stops working wi开发者_如何学Goth an error message similar to

Permission denied - /var/www/myapp/tmp/cache/609/E30/configuration_1

To fix it I have to manually change the ownership of the app directory:

chown -R nobody:nogroup /var/www/myapp

The CRON is running under the web server user nobody:

@weekly cd /var/www/myapp && /usr/local/bin/ruby /usr/local/bin/rake tmp:cache:clear

I also tried adding && chown -R nobody:nogroup /var/www/myapp to crontab with no luck.

What am I doing wrong?


Have you tried adding && chown -R nobody:nogroup /var/www/myapp/tmp/cache to the cronjob? Changing only the ownership of /var/www/myapp is not enough, the web server will need write access to the tmp/cache subdirectory, too.

0

精彩评论

暂无评论...
验证码 换一张
取 消