-
-
Save gibron/993de4c2411db1022fd6ddd5c2194dc6 to your computer and use it in GitHub Desktop.
AEM Compaction Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
now="$(date +'%d-%m-%Y')" | |
logfile="compact-$now.log" | |
installfolder="~" | |
aemfolder="$installfolder/crx-quickstart" | |
oakrun="$installfolder" | |
## Shutdown AEM | |
printf "Shutting down AEM.\n" | |
$aemfolder/bin/stop | |
now="$(date)" | |
echo "AEM Shutdown at: $now" >> $installfolder/help/logs/$logfile | |
## Find old checkpoints | |
printf "Finding old checkpoints.\n" | |
java -Dtar.memoryMapped=true -Xms8g -Xmx8g -jar $oakrun checkpoints $aemfolder/repository/segmentstore >> $installfolder/help/logs/$logfile | |
## Delete unreferenced checkpoints | |
printf "Deleting unreferenced checkpoints.\n" | |
java -Dtar.memoryMapped=true -Xms8g -Xmx8g -jar $oakrun checkpoints $aemfolder/repository/segmentstore rm-unreferenced >> $installfolder/help/logs/$logfile | |
## Run compaction | |
printf "Running compaction. This may take a while.\n" | |
java -Dtar.memoryMapped=true -Xms8g -Xmx8g -jar $oakrun compact $aemfolder/repository/segmentstore >> $installfolder/help/logs/$logfile | |
## Report Completed | |
printf "Compaction complete. Please check the log at:\n" | |
printf "$installfolder/help/logs/$logfile\n" | |
## Start AEM back up | |
now="$(date)" | |
printf "Starting up AEM.\n" | |
$aemfolder/bin/start | |
echo "AEM Startup at: $now" >> $installfolder/help/logs/$logfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment