These are the scripts currently run by hand on the old EC2 server to do a full upgrade (safe storeall handshake, backups, explode WAR, run the manager schema-migration tool, restart Tomcat). Committed as-is for now to review and refactor from, except tomcat_ctl.sh, which is already rewritten to control Tomcat via the new Docker container's supervisord (through the "service" shim) instead of the old host's /etc/init.d/tomcat8, since that service doesn't exist there. Kept as a drop-in replacement: the "status" output still contains both literal substrings upgrade.sh and restart.sh each grep for, so neither caller needed to change yet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tj4SF2BGFxgoRYrCAzNpDb
41 lines
1.6 KiB
Bash
41 lines
1.6 KiB
Bash
#!/bin/bash
|
|
# Rewritten for the new Docker-based server: Tomcat runs under supervisord
|
|
# inside the app container, not as a real /etc/init.d/tomcat8 service like on
|
|
# the old EC2 host. start/stop/restart go through the "service" shim the
|
|
# Dockerfile installs (sportrum-ansible's files/app/service-shim.sh), already
|
|
# proven working this session (`sudo service tomcat restart` -> "tomcat:
|
|
# stopped" / "tomcat: started"). status queries supervisorctl directly
|
|
# instead, since its output format is well-defined and doesn't depend on
|
|
# what commands the shim itself happens to support.
|
|
#
|
|
# Kept as a drop-in replacement on purpose: upgrade.sh and restart.sh each
|
|
# grep this script's "status" output for a different literal string
|
|
# ("tomcat8 is stopped" vs "not running") depending on which one calls it.
|
|
# Both substrings are included below whenever tomcat isn't running, so
|
|
# neither caller needs to change.
|
|
#
|
|
# JAVA_HOME/JAVA_OPTS from the old version are dropped: the container's base
|
|
# image (eclipse-temurin) already sets JAVA_HOME itself, and the JAVA_OPTS
|
|
# line here was commented out (inactive) in the original anyway. If real
|
|
# JAVA_OPTS are ever needed, set them in the container's own environment
|
|
# (docker-compose.yml.j2's "environment:" block for the app service) rather
|
|
# than here.
|
|
cmd=$1
|
|
|
|
case "$cmd" in
|
|
status)
|
|
raw=$(sudo supervisorctl status tomcat)
|
|
if echo "$raw" | grep -q "RUNNING"; then
|
|
echo "tomcat8 is running: $raw"
|
|
else
|
|
echo "tomcat8 is stopped, not running: $raw"
|
|
fi
|
|
;;
|
|
start|stop|restart)
|
|
sudo service tomcat "$cmd"
|
|
;;
|
|
*)
|
|
echo "Unknown command: $cmd" >&2
|
|
exit 1
|
|
;;
|
|
esac
|