Offline compaction is still the Adobe recommended way of compacting Oak. Below is a script to help automate the entire process. Please keep in mind that you will need to download a version of Oak Run that matches your repository version.
- Shutdown AEM
- Find Old Checkpoints
- Remove Unreferenced Checkpoints
- Compact Oak
- Restart AEM
Each step will log basic information into a file using the current date. The stop and start processes specifically write the exact time they were kicked off.
Note: I've taken the liberty of adding a few arguments to the compaction process to help with memory issues. You can read about tar memory mapping here.