1.
Ok, I will save that file as .sh and I will set execute permission on the file.
2.
"
It's probably best to specify an absolute path, like /home/your_username/public_html/cache"
How and where to set it, somewhere in this code:
Code: Select all
#!/bin/bash
find $1 -type f -size -10k -delete
exit 0
or somewhere else?
3.
Site has about 33000 pages and they are cached in cache folder to speed up next time show, and because most of pages do not change content at all, they can be cached for very long time (for months). But caching script makes for every new or updated cached version of page some very small file, which is practically junk and can be deleted, and also "page not found" pages are cached too, for those files I need this. So, when I start using caching script I will start to use this one too. On first run this script will have to delete lots of those files, next time less, and less, and after some time most pages are cached and like I said they are cached for long time, so there will be no lot of new cached pages so there will be no to much new junk files to delete.
But still this script will need to go trough all folders and files, eventually trough up to 35000 pages in up to about 35 folders every time, right, maybe that will take time, even small percent will be deleted?
For now it is planed for about 33000 pages but in future it might be more. But practically script will never need to delete 33000 pages or something like that, most likely it will need to delete up to few thousand files (first days) and after few days probably just few hundreds, at least those are my best expectations. At the beginning I guess it will be enough to run script one time per day in first week, after that one time in few days. Site is on virtual private server 4 x 2.8 CPU core, so I hope it will run easily?