[user@localhost TOMCAT]$ pwd
/APP/TOMCAT
[user@localhost TOMCAT]$ ls -lrth
total 36K
drwxrwxr-x. 5 user user 94 Mar 7 2023 OLD
lrwxrwxrwx. 1 user user 21 Mar 29 2023 tomcat -> apache-tomcat-9.0.73/
-rwxrw-r--. 1 user user 256 Mar 29 2023 tomcat_log.sh
-rwxrwxr-x. 1 user user 656 May 26 2023 autoRestartTomcat.sh
drwxrwxr-x. 10 user user 230 Dec 11 09:53 apache-tomcat-9.0.73
-rw-rw-r--. 1 user user 28K Dec 18 03:00 autoRestartTomcat.log
[user@localhost TOMCAT]$
[user@localhost TOMCAT]$
[user@localhost TOMCAT]$ cat autoRestartTomcat.sh
#!/bin/sh
##### tomcat stop and start ( every 03:00 )
# 0 3 * * * /APP/TOMCAT/autoRestartTomcat.sh >> /APP/TOMCAT/autoRestartTomcat.log 2>&1
#############################################################################################
##### step 1
export CATALINA_HOME=/APP/TOMCAT/tomcat/
export PATH="$PATH:$CATALINA_HOME/bin"
export nowDate=`date +%Y-%m-%d%t%H:%M`
tomcat_pid() {
echo `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }'`
}
##### step 2
echo "$nowDate"
pid=$(tomcat_pid)
echo "killing pid: $pid"
kill -9 $pid
sleep 10
$CATALINA_HOME/bin/startup.sh
echo "$nowDate Server startup END!!!"
[user@localhost TOMCAT]$
[user@localhost TOMCAT]$ crontab -l
0 3 * * * /APP/TOMCAT/autoRestartTomcat.sh >> /APP/TOMCAT/autoRestartTomcat.log 2>&1
[user@localhost TOMCAT]$
'Tool > WEB,WAS' 카테고리의 다른 글
tomcat / jdk / setenv / windows / linux (0) | 2023.09.24 |
---|---|
tomcat / windows / log4j / log4j.properties (0) | 2023.09.20 |
tomcat / catalina.out / 일자별 log (0) | 2021.10.05 |
Jboss 7.1.1 as Windows service (0) | 2020.04.27 |
WAS / jBoss 7.1 (0) | 2020.04.24 |