-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache dir - autodelete? #129
Comments
this can be good for this? |
Yes, the function fileatime can be used to check when a cached image was last accessed. I had some thoughts on implementing such a cleanup facility within img.php, but I choose to leave it for now. If I would implement it in img.php there might be concerns on when to do autodelete and if it could be initiated from an url, perhaps protected by a password. For now, there is a script bin
You could put such a command in the crontab to make it run nightly. This implies you have the access to the server and its a unix-like server. To make it work on a hosted webserver, where you dont have access to the shell, you most likely would need a PHP-solution through the url. So there might be a usecase for this. |
Running the command
Seems like I have some old and not used items in my cache, not to much though. |
I'll close this for now. Lets reopen it if it turns out there is a great need for a cache-cleaning solution using a PHP-script, instead of bash/crontab. |
Hello, thanks for your solution, but it seems this method is not suit for me, here is the output :) SizeTotal size: 37G Top-5 largest files/dirs:./cache.sh: line 29: /usr/bin/du: Argument list too long Last-5 created files:2015-12-21 09:35 cache/remote/ffb2574bf08f473e87c18b68209dc137.json Last-5 accessed files:2015-12-21 08:05 fc9c08a98d0bacc8f06c204a24f320fe.json 5 Oldest files:2015-12-10 11:56 007ea81677530c8964fae5f74e2f88db Files not accessed within the last 30 daysNumber of files: 0 |
... and the "find ./cache/ -type f -atime +14 -exec rm {} ;" is not working for me :'( or this can happen if... find ./cache/* -type f -atime +14 -exec rm {} ; |
And your operatingsystem/version and version of bash is? And if you run the individual commands in the bash-file, what is the error message output? |
hello, OS: Centos 6.7, Linux version 2.6.32-573.8.1.el6.x86_64 Only this error: line 29: /usr/bin/du: Argument list too long I think only the files number in that director is the problem :) Thanks UPDATE 2; UPDATE; |
Hello,
I really like your script, very nice job!
But i think the cache autodelete/autopurge feature would be cool!
(Example: delete unused images after X days)
Thanks
bye
The text was updated successfully, but these errors were encountered: