-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jboss
97 lines (80 loc) · 3.13 KB
/
Jboss
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
#!/bin/bash
export EAPV=7.2
CUSTOMER=$2
printf "%s\n"
printf "%s\n" "-------------------------------------------------------------------"
cmdlist="Commandlist::l|p|d|rst|st|stall|stp|stpall|dx|hx|cli|log|ylog"
if [ -z "$1" ]
then
printf '%s\n' $cmdlist
printf "Enter the name of command: "
read cmd
else
cmd="$1"
fi
case $cmd in
rst)
kill -9 `ps -ef | grep jboss | grep -v grep |grep $CUSTOMER | awk '{print $2}'`
sleep 2s
nohup /use/app/jboss-eap-$EAPV-$CUSTOMER/bin/domain.sh &
tailf /use/data/log/$CUSTOMER/server.log
;;
stp)
kill -9 `ps -ef | grep jboss | grep -v grep | grep $CUSTOMER | awk '{print $2}'`
;;
stpall)
kill -9 `ps -ef | grep jboss | grep -v grep | grep jboss-eap | awk '{print $2}'`
;;
st)
nohup /use/app/jboss-eap-$EAPV-$CUSTOMER/bin/domain.sh &
;;
stall)
`nohup /use/app/jboss-eap-7.2-$CUSTOMER1/bin/domain.sh` & '&&' `nohup /use/app/jboss-eap-7.2-$CUSTOMER2/bin/domain.sh` &
;;
l)
ps -ef | grep jboss | grep domain.sh
;;
d)
/use/app/jboss-eap-7.2-$CUSTOMER1/bin/jboss-cli.sh --controller=$SERVERIP:9990 -c command='/deployment=*:read-attribute(name=name)' |grep 'address\|outcome' |awk '{ print $3 $5 }' | sed 's/[^a-zA-Z0-9.-]//g' |sed 's/deployment//' |sed 's/success//' | column -x
;;
p)
grep "port=" /use/app/jboss-eap-7.2-*/domain/configuration/domain.xml | sed -e 's#.*=\(\)#\1#' | grep -Eo '[0-9]{1,6}' | netstat -tpuln 2>/dev/null | grep 'tcp ' |grep -v 22 | grep -v 25 | grep -v 41824 | grep -v 111 | awk '{print $4 " " $6}' | cut -d':' -f2 | sort -n | column -x
;;
log)
(echo /use/data/log/$CUSTOMER/server.log ;printf "%s\n" "-------------------------------------------------------------------" ; tailf /use/data/log/$CUSTOMER/server.log)
;;
ylog)
less +F /use/data/log/use-main-server/server.log.$(date --date="yesterday" +"%Y-%m-%d")
;;
dx)
vim /use/app/jboss-eap-$EAPV-$CUSTOMER/domain/configuration/domain.xml
;;
hx)
vim /use/app/jboss-eap-$EAPV-$CUSTOMER/domain/configuration/host.xml
;;
cli)
/use/app/jboss-eap-$EAPV-$CUSTOMER/bin/jboss-cli.sh --connect controller="$( hostname -I | awk '{ print $1}' )":9999
;;
help)
echo "Here is the jb help, by Mehrdad 2022."
echo
echo "Syntax: jb [-l|p|d|rst|st|stall|stp|stpall|dx|hx|cli|log|ylog]"
echo "options:"
echo -e '\t'"-l show list of running jboss"
echo -e '\t'"-p show all ports status of domain.xml"
echo -e '\t'"-d show list of deployment"
echo -e '\t'"-rst \$CUSTOMER reset jboss and show log"
echo -e '\t'"-stp \$CUSTOMER stop jboss"
echo -e '\t'"-stall start all jboss"
echo -e '\t'"-stpall stop all jboss"
echo -e '\t'"-log \$CUSTOMER show tail log of jboss"
echo -e '\t'"-jb ylog \$CUSTOMER show tail log of jboss for yesterday"
echo -e '\t'"-jb dx \$CUSTOMER vi domain.xml"
echo -e '\t'"-jb hx \$CUSTOMER vi host.xml"
echo -e '\t'"-jb cli \$CUSTOMER jboss cli"
echo
;;
*)
printf '%s\n' $cmdlist
;;
esac