-
-
Save wildone/073910a856a935dc33b5 to your computer and use it in GitHub Desktop.
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 | |
# Bash script to run AEM 6.0 and 6.1 Repository Check | |
# Author : Jayan Kandathil | |
# Version : 0.1 | |
# Last updated : July 6, 2015 | |
# Instructions : Copy to CQ's /bin folder, make necessary changes, enable the execute bit and run | |
# Echo on (for debugging purposes) | |
# set -x verbose | |
# Host that CQ runs on | |
HOST=localhost | |
# TCP port CQ listens on | |
PORT=4502 | |
# CQ Admin user ID | |
USER=admin | |
# CQ Admin user password | |
PASSWORD=admin | |
# CQ Home | |
CQ_HOME=/opt/aem/author/crx-quickstart | |
# CQ Maintenance in progress file | |
MAINTENANCE_FILE=$CQ_HOME/logs/repocheck_in_progress.txt | |
# CQ Maintenance log file | |
LOG_FILE=$CQ_HOME/logs/aem_repository_check.log | |
# ------------------------------------------------ | |
# Do not configure below this point | |
# ------------------------------------------------ | |
# Log timestamp | |
date | tee -a $LOG_FILE | |
# Back off if the previous maintenance operation is still in progress | |
if [ -f $MAINTENANCE_FILE ]; | |
then | |
echo $'\n'"Previous maintenance operation still in progress..., backing off till next time."$'\n' | tee -a $LOG_FILE | |
else | |
#Create an empty text file indicating maintenance in progress | |
touch $MAINTENANCE_FILE | tee -a $LOG_FILE | |
echo "Starting Repository check..."$'\n' | |
START=$(date +%s) | |
time curl -u $USER:$PASSWORD -X POST --data "workspace=crx.default&path=%2F&traversal=on&fixinconsistencies=on&datastoreconsistency=on" http://$HOST:$PORT/system/console/repositorycheck | tee -a $LOG_FILE | |
END=$(date +%s) | |
DIFF=$(( $END - $START )) | |
echo "Finished."$'\n' | |
echo "Took $DIFF seconds"$'\n' | |
# Remove file which indicates that maintenance is in progress | |
rm $MAINTENANCE_FILE | tee -a $LOG_FILE | |
fi | |
# Log timestamp | |
date | tee -a $LOG_FILE | |
echo $'\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment