-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.profile_aem
150 lines (127 loc) · 4.33 KB
/
.profile_aem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash
### AEM
# Displays an overview of all running AEM instances
function aemi(){
if [ "$(ps aux | grep [c]q)" ]
then
count=0;
echo ""
ps aux | grep [c]q | while read -r line ; do
((count++));
params=($line);
username=(${params[0]});
pid=(${params[1]});
port="not found";
debugPort="not found";
runmodes="not found";
xmx="not found";
path=$(readlink -e /proc/$pid/cwd/);
portRegex="-p ([0-9]+)";
debugPortRegex="address=([0-9]+)";
runmodesRegex="-Dsling.run.modes=([^[:space:]]+)";
xmxRegex="-Xmx([^[:space:]]+)";
[[ $line =~ $portRegex ]] && port="${BASH_REMATCH[1]}";
[[ $line =~ $debugPortRegex ]] && debugPort="${BASH_REMATCH[1]}";
[[ $line =~ $runmodesRegex ]] && runmodes="${BASH_REMATCH[1]}";
[[ $line =~ $xmxRegex ]] && xmx="${BASH_REMATCH[1]}";
echo "----------------------";
echo "AEM Instance" $count;
echo "----------------------";
echo "username: "$username;
echo "pid: "$pid;
echo "port: "$port;
echo "debugPort: "$debugPort;
echo "runmodes: "$runmodes;
echo "memory: "$xmx;
echo "path: "$path;
echo "----------------------";
echo "";
done
else
echo "";
echo "No running AEM instances found";
echo "";
fi
}
function searchaem() {
if [[ "$PWD" == "/" && "$(which_os)" == 'Windows' ]]
then
echo "go to a drive"
echo "e.g.: cd /c"
echo "possible drives are:"
wmic logicaldisk get caption
else
find $(pwd) -type d -name "crx-quickstart"
fi
}
# Color CQ-Log
function cqlog() {
tail -fn 128 "$@" | awk '
/SEVERE/ {print "\033[35m" $0 "\033[39m"}
/ERROR/ {print "\033[31m" $0 "\033[39m"}
/WARN/ {print "\033[33m" $0 "\033[39m"}
/DEBUG/ {print "\033[30m" $0 "\033[39m"}
!/SEVERE|ERROR|WARN|DEBUG/ {print $0 }
';}
function deletePauseInstallation () {
_auth=admin:admin
_host=localhost
_port=4502
for i in "$@"
do
case $i in
-a=*|--auth=*)
_auth="${i#*=}"
shift
;;
-h=*|--host=*)
_host="${i#*=}"
shift
;;
-p=*|--port=*)
_port="${i#*=}"
shift
;;
esac
done
echo
echo "delete pauseInstallation on server ${_host}:${_port}"
echo
curl -X DELETE http://${_host}:${_port}/system/sling/installer/jcr/pauseInstallation -u ${_auth}
}
# Death to all CQ instances!
function killcq() {
kill $(ps aux | grep '[c]rx-quickstart' | awk '{print $2}')
}
# CQ, Y U NO DIE?
function KILLCQ() {
killcq -9
}
AUTHOR_PATH=/opt/aem/author
PUBLISH_PATH=/opt/aem/publish
DISPATCHER_LOG=/var/log/httpd/dispatcher.log
alias astop='$AUTHOR_PATH/crx-quickstart/bin/stop'
alias astart='$AUTHOR_PATH/crx-quickstart/bin/start'
alias astatus='$AUTHOR_PATH/crx-quickstart/bin/status'
alias alog='tail -f -n 1000 $AUTHOR_PATH/crx-quickstart/logs/error.log'
alias pstop='$PUBLISH_PATH/crx-quickstart/bin/stop'
alias pstart='$PUBLISH_PATH/crx-quickstart/bin/start'
alias pstatus='$PUBLISH_PATH/crx-quickstart/bin/status'
alias plog='tail -f -n 1000 $PUBLISH_PATH/crx-quickstart/logs/error.log'
alias displog='sudo tail -f -n 1000 $DISPATCHER_LOG'
# tail all log files to the virtual box shared folder
function mountLog(){
# Virtual Box shared folder path on guest system
sharename="share"
VB_SHARED_FOLDER="/mnt/$sharename"
sudo mkdir $VB_SHARED_FOLDER
sudo chmod 777 $VB_SHARED_FOLDER
sudo mount -t vboxsf -o uid=1000,gid=1000 $sharename $VB_SHARED_FOLDER
files=( "access.log" "error.log" "request.log" )
for i in "${files[@]}"
do
sudo tail -f -n 1000 "$AUTHOR_PATH/crx-quickstart/logs/$i" > "$VB_SHARED_FOLDER/author/$i" &
sudo tail -f -n 1000 "$PUBLISH_PATH/crx-quickstart/logs/$i" > "$VB_SHARED_FOLDER/publish/$i" &
done
sudo tail -f -n 1000 "$DISPATCHER_LOG" > "$VB_SHARED_FOLDER/dispatcher.log" &
}