53 lines
1.2 KiB
Bash
53 lines
1.2 KiB
Bash
#! /bin/bash
|
|
|
|
|
|
. portal-env.sh
|
|
|
|
|
|
#define tomcat variables
|
|
export CATALINA_BASE="${CATALINA_BASE:-$CATALINA_HOME}"
|
|
export JPDA_ADDRESS="${JPDA_ADDRESS:-8001}"
|
|
export JPDA_TRANSPORT="${JPDA_TRANSPORT:-dt_socket}"
|
|
#export CATALINA_OPTS='-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n'
|
|
|
|
|
|
get_most_recent() {
|
|
|
|
most_recent_file="`perl -le '@sorted = map {$_->[0]}
|
|
sort {$a->[1] <=> $b->[1]}
|
|
map {[$_, -M $_]}
|
|
@ARGV;
|
|
print $sorted[0]' $1`"
|
|
|
|
}
|
|
|
|
cd "${CATALINA_HOME}"
|
|
|
|
# start tail of catalina.out in new window
|
|
# shift and $* allows any additional options to be applied to the tail command
|
|
# such as -l 1000 to open with the previous 1000 lines
|
|
if [ "$1" == "tail" ]; then
|
|
shift 1
|
|
cd logs
|
|
get_most_recent 'localhost*.log'
|
|
localhost_log="${most_recent_file}"
|
|
get_most_recent 'localhost_access_log*.txt'
|
|
localhost_access_log="${most_recent_file}"
|
|
catalina_out="catalina.out"
|
|
$terminal tail -f "${catalina_out}" "${localhost_log}" "${localhost_access_log}" $* &
|
|
exit
|
|
fi
|
|
|
|
|
|
#use terminal for the run command
|
|
case "$*" in
|
|
env)
|
|
;;
|
|
*run)
|
|
$terminal "${CATALINA_HOME}/bin/catalina.sh" $* &
|
|
;;
|
|
|
|
*)
|
|
"${CATALINA_HOME}/bin/catalina.sh" $*
|
|
;;
|
|
esac |