Last active
November 26, 2018 09:47
-
-
Save auniverseaway/34ca41dfabc3cb5d9a45 to your computer and use it in GitHub Desktop.
AEM Compaction Script
This file contains hidden or 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="/data/aem" | |
aemfolder="$installfolder/crx-quickstart" | |
oakrun="$installfolder/help/oak-run-1.0.18.jar" | |
## 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