sportrum-deploy/restart.sh
Claude b0c2893ad7
Parameterize runcmd to support commands beyond storeall
runcmd was hardcoded to the storeall command/status-file pair. Generalizing
it now so finishcalls and dumpregistry (planned server-side additions) can
reuse the same commands.txt/status.<cmd>.$pid polling handshake instead of
needing near-duplicate copies of the function.

Signature changed from `runcmd <resultvar>` to `runcmd <resultvar> <command>
[args...]`; updated the two existing call sites (restart.sh, upgrade.sh)
accordingly. Behavior for storeall itself is unchanged - verified the
generated commands.txt line is byte-identical to before.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tj4SF2BGFxgoRYrCAzNpDb
2026-09-29 20:51:47 +00:00

28 lines
570 B
Bash

#!/bin/bash
. ./upgrade-funs.sh
action="reboot"
pid=$$
if [ "x$1" != "x" ]; then
action=$1;
fi
running=$(./tomcat_ctl.sh status | grep "not running")
if [ "x$running" == "x" ]; then
printf "Call server command storeall.."; sleep 2
runcmd result storeall
if [ "x$result" == "xsuccess" ]
then
echo " done!"
else
echo " failed! exiting..."
exit 1
fi
echo "Stopping tomcat.."; sleep 2
./tomcat_ctl.sh stop
else
echo "Tomcat is not running!"
fi
if [ $action == "reboot" ]; then
echo "Starting tomcat..."; sleep 2
./tomcat_ctl.sh start
fi