Task #90
openFeature #82: Implement a work copy of our website
Task #9: Add a cron script to make a static copy of Spip
Purge old website snapshot directories
90%
Description
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
test/
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 over 13 years ago
- Due date set to 05/16/2011
- Start date changed from 05/30/2011 to 05/09/2011
Updated by Jean-Michel Philippe about 13 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.
Updated by Jean-Michel Philippe about 13 years ago
- Status changed from In Progress to Ready for test
- % Done changed from 0 to 90
The code is online with removal code commented out :). We have to check that everything is fine during weeks before putting all into automatic mode.