Now that the daily cron task is on, we get a new snapshot directory everyday. Only two of them are actually used:
- the snapshot pointed by
web/is the official website and must not be removed
- the snapshot of the day, which is pointed by
All other snapshot directories can be purged. We can however decide to keep say 10 of them for security reasons or to be able to perform stats on size or nbr. of files.
Updated by Jean-Michel Philippe about 12 years ago
- Status changed from New to In Progress
Older directories to be removed can be listed with this command:
$ find . -maxdepth 1 -name 'snapshot-*' -mtime +5 | sort
It is possible to remove a particular directory from the list:
$ find . -maxdepth 1 -name 'snapshot-*' ! -name 'snapshot-20111117' | sort
This can be used to ignore the directory which is pointed by web/:
$ find . -maxdepth 1 -name 'snapshot-*' ! -name $(basename "$(readlink web)") | sort
Finally, the command that lists old directories not being the target of the symlink web/ is:
$ find . -maxdepth 1 -name 'snapshot-*' -mtime +5 ! -name $(basename "$(readlink web)") | sort
Note that if the symlink is regularly updated, it should not appear in the list of old directories. Moreover the code deleting directories must be disabled when the symlink cannot be moved to the latest snapshot, due to mirroring errors.