AEM 6.+ - Example kill command for killing AEM java process.
#!/bin/bash
install_folder="/opt/aem"
aem_folder="$install_folder/crx-quickstart"
#
# FUNCTION: ts (timestamp)
# DESCRIPTION:
# Generates a timestamp
#
ts() {
date +"%Y-%m-%d %H:%M:%S"
}
# grab the PID of the java running process
# jlw: this will break if there is more than one java process running.
# PID=$(pgrep java)
PID=$(cat $aem_folder/conf/cq.pid 2>/dev/null)
rm -f $aem_folder/conf/cq.pid
if ps -p $PID > /dev/null 2>&1; then
kill $PID
echo "$(ts): process ${PID} was killed"
else
echo "$(ts): process ${PID} not running"
fi