1
0
mirror of synced 2026-01-25 20:06:44 +00:00

Some polish on the new loadup scripts - dribble files and lock overrides (#2157)

Three changes to loadup scripts:

1) dribble files are now copied from the workdir into loadups if loadup completes successfully, 

2) if the lock preventing simultaneous runs is already set when loadup starts, it now asks the user if they want to override the lock or to exit (previously it just exited), 

3) there is now a --override flag that will automatically override the lock without asking the user.  

Man page updated accordingly.
This commit is contained in:
Frank Halasz
2025-05-19 09:48:39 -07:00
committed by GitHub
parent 2499b3546e
commit 330c5a01a7
6 changed files with 84 additions and 21 deletions

View File

@@ -17,6 +17,7 @@ main() {
nocopy=false
thinw=false
thinl=false
override_lock=false
while [ "$#" -ne 0 ];
do
case "$1" in
@@ -144,6 +145,9 @@ main() {
export MAIKODIR="${maikodir}"
shift
;;
-ov | -override | --override)
override_lock=true
;;
--noendmsg)
noendmsg=true
;;
@@ -251,7 +255,7 @@ main() {
# check and set the run_lock
check_run_lock
check_run_lock "${override_lock}"
# if requested, thin the loadups and workdirs by eliminating all versioned (*.~[0-9]*~) files
# from these directories
@@ -348,18 +352,24 @@ main() {
then
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/lisp.sysout "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/lisp.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
if [ $start -le 3 ] && [ $end -ge 4 ]
then
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/full.sysout "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/full.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
if [ $start -le 4 ] && [ $end -ge 5 ]
then
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/apps.sysout "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/apps.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
if [ "${aux}" = true ]
@@ -368,12 +378,18 @@ main() {
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/exports.all "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/whereis.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/exports.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
if [ "${db}" = true ]
then
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/fuller.database "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/fuller.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
fi

View File

@@ -249,13 +249,39 @@ process_maikodir() {
export LOADUP_LOCKFILE="${LOADUP_WORKDIR}"/lock
check_run_lock() {
if [ -e "${LOADUP_LOCKFILE}" ]
then
output_error_msg "Error: Another loadup is already running with PID $(cat "${LOADUP_LOCKFILE}")${EOL}Exiting."
exit 1
fi
echo "$$" > "${LOADUP_LOCKFILE}"
LOADUP_LOCK="$$"
set +x
if [ -e "${LOADUP_LOCKFILE}" ]
then
output_warn_msg "Warning: Another loadup is already running with PID $(cat "${LOADUP_LOCKFILE}")"
if [ "${override_lock}" = true ]
then
output_warn_msg "Overriding lock preventing simultaneous loadups due to command line argument --override${EOL}Continuing."
else
loop_done=false
while [ "${loop_done}" = "false" ]
do
output_warn_msg "Do you want to override the lock guarding against simultaneous loadups?"
output_warn_msg "Answer [y, Y, n or N, default n] followed by RETURN"
read resp
if [ -z "${resp}" ]; then resp=n; fi
case "${resp}" in
n* | N* )
output_error_msg "Ok. Exiting"
exit 5
;;
y* | Y* )
output_warn_msg "Ok. Overriding lock and continuing"
loop_done=true
;;
* )
output_warn_msg "Answer not one of Y, y, N, or n. Retry."
;;
esac
done
fi
fi
echo "$$" > "${LOADUP_LOCKFILE}"
LOADUP_LOCK="$$"
}
remove_run_lock() {