-
Notifications
You must be signed in to change notification settings - Fork 1
/
tomcat8.erb
65 lines (60 loc) · 1.04 KB
/
tomcat8.erb
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
#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
NAME=tomcat
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.151.x86_64
export JAVA_HOME
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/opt/tomcat
tomcat_pid() {
pgrep -f $CATALINA_HOME
}
start() {
pid=$(tomcat_pid)
if [ -n "$pid" ]; then
echo "Tomcat is already running"
exit 1
fi
sudo sh $CATALINA_HOME/bin/startup.sh
}
stop() {
pid=$(tomcat_pid)
if [ -z "$pid" ]; then
echo "Tomcat is not running"
exit 1
fi
sudo sh $CATALINA_HOME/bin/shutdown.sh
}
status() {
pid=$(tomcat_pid)
if [ -n "$pid" ] ; then
printf "$NAME process running with pid: $pid\n"
exit 0
else
log_daemon_msg "$NAME Process is not running\n"
log_end_msg 0
exit 1
fi
}
case $1 in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart)
stop
start
RETVAL=$?
;;
status)
status
RETVAL=$?
;;
esac
exit $RETVAL