Last active
May 8, 2023 05:59
-
-
Save nfhipona/c2809304e99478e2d5d4d13b7b44e9b7 to your computer and use it in GitHub Desktop.
AEM Run 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/sh | |
# https://gist.github.com/nferocious76/c2809304e99478e2d5d4d13b7b44e9b7 | |
PORT=4502 | |
NAME="author" | |
FILE="aem-author-p4502.jar" | |
# find and kill active instance on port $PORT | |
INSTANCE=$(netstat -vanp tcp | grep $PORT) | |
if [ ! -z "$INSTANCE" ]; then | |
echo "\nProcess instance found on port: $PORT\n" | |
echo $INSTANCE | |
echo "\nCollecting PID IDs of instances on port: $PORT" | |
PID=$(ps aux | grep $PORT | grep -v grep | awk '{print $2}') | |
echo "Killing process of $NAME instances on port: $PORT" | |
kill -9 $PID | |
else | |
echo "\nNo active $NAME instances on port: $PORT" | |
fi | |
# java command reference | |
# https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/development/set-up-a-local-aem-development-environment.html?lang=en | |
echo "Starting local server instance on port $PORT\n" | |
sleep 3 | |
java -Xmx2048M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=30303 -jar $FILE -gui -r"$NAME,localdev" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment