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:
@@ -103,14 +103,16 @@ The target files are copied from this work directory to the loadups
|
|||||||
directory if the loadup is successful.
|
directory if the loadup is successful.
|
||||||
Each stage of the loadup also creates a dribble file containing the
|
Each stage of the loadup also creates a dribble file containing the
|
||||||
terminal output from within the Medley environment.
|
terminal output from within the Medley environment.
|
||||||
These dribble files are not copied to the loadups directory, but remain
|
These dribble files are also copied to the loadups directory, but also
|
||||||
available in the work directory after the loadup completes.
|
remain available in the work directory after the loadup completes.
|
||||||
.PP
|
.PP
|
||||||
Only one instance (per <MEDLEIDIR>) of loadup can be run at a time.
|
Only one instance (per <MEDLEIDIR>) of loadup can be run at a time.
|
||||||
(The lock file is in the work directory and is named
|
There is lock file to prevent simultaneous loadups in the work directory
|
||||||
\f[B]\f[BI]lock\f[B]\f[R].
|
(named \f[B]\f[BI]lock\f[B]\f[R]) that can be manually removed.
|
||||||
It can be removed in case of an uncontrolled failure of the loadup
|
The lock can also be automatically overridden (see the \[en]override
|
||||||
procedure.)
|
flag below).
|
||||||
|
Alternatively, if a lock is encountered at run time, the user will be
|
||||||
|
asked to choose whether to override or simply exit the loadup.
|
||||||
.PP
|
.PP
|
||||||
Note: \f[B]MEDLEYDIR\f[R] is an environment variable set by the loadup
|
Note: \f[B]MEDLEYDIR\f[R] is an environment variable set by the loadup
|
||||||
script.
|
script.
|
||||||
@@ -253,6 +255,12 @@ Synonym for \[lq]\[en]target apps\[rq]
|
|||||||
\f[B]-a-, --apps-, -apps-, -5-\f[R]
|
\f[B]-a-, --apps-, -apps-, -5-\f[R]
|
||||||
Synonym for \[lq]\[en]target apps\[rq]
|
Synonym for \[lq]\[en]target apps\[rq]
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-ov, --override, -override\f[R]
|
||||||
|
Automatically override the lock that prevents two loadups from running
|
||||||
|
simultaneously.
|
||||||
|
If this flag is not set and an active lock is encountered, the user will
|
||||||
|
be asked to choose whether to override or exit.
|
||||||
|
.TP
|
||||||
\f[B]-nc, --nocopy, -nocopy\f[R]
|
\f[B]-nc, --nocopy, -nocopy\f[R]
|
||||||
Run the specified loadups, but do not copy results into loadups
|
Run the specified loadups, but do not copy results into loadups
|
||||||
directory.
|
directory.
|
||||||
|
|||||||
Binary file not shown.
@@ -48,10 +48,10 @@ The two independent stages that can be run if the first 4 sequential stages comp
|
|||||||
>+ **DB:**: creates the *fuller.database* file. Fuller.database is a Mastercope database created by analyzing all of the source code included in full.sysout. (Stage 4) Fuller.database is copied into the loadups directory.
|
>+ **DB:**: creates the *fuller.database* file. Fuller.database is a Mastercope database created by analyzing all of the source code included in full.sysout. (Stage 4) Fuller.database is copied into the loadups directory.
|
||||||
|
|
||||||
|
|
||||||
Loadup does all of its work in a work directory (\<MEDLEYDIR>loadups/build). The target files are copied from this work directory to the loadups directory if the loadup is successful. Each stage of the loadup also creates a dribble file containing the terminal output from within the Medley environment. These dribble files are not copied to the loadups directory, but remain available in the work directory after the loadup completes.
|
Loadup does all of its work in a work directory (\<MEDLEYDIR>loadups/build). The target files are copied from this work directory to the loadups directory if the loadup is successful. Each stage of the loadup also creates a dribble file containing the terminal output from within the Medley environment. These dribble files are also copied to the loadups directory, but also remain available in the work directory after the loadup completes.
|
||||||
|
|
||||||
|
|
||||||
Only one instance (per \<MEDLEIDIR>) of loadup can be run at a time. (The lock file is in the work directory and is named ***lock***. It can be removed in case of an uncontrolled failure of the loadup procedure.)
|
Only one instance (per \<MEDLEIDIR>) of loadup can be run at a time. There is lock file to prevent simultaneous loadups in the work directory (named ***lock***) that can be manually removed. The lock can also be automatically overridden (see the --override flag below). Alternatively, if a lock is encountered at run time, the user will be asked to choose whether to override or simply exit the loadup.
|
||||||
|
|
||||||
Note: **MEDLEYDIR** is an environment variable set by the loadup script. It is set to the top level directory of the Medley installation that contains the specific loadup script that
|
Note: **MEDLEYDIR** is an environment variable set by the loadup script. It is set to the top level directory of the Medley installation that contains the specific loadup script that
|
||||||
is invoked after all symbolic links are resolved. In the standard global installation this will
|
is invoked after all symbolic links are resolved. In the standard global installation this will
|
||||||
@@ -120,6 +120,9 @@ OPTIONS
|
|||||||
**-a-, \-\-apps-, -apps-, -5-**
|
**-a-, \-\-apps-, -apps-, -5-**
|
||||||
: Synonym for "--target apps"
|
: Synonym for "--target apps"
|
||||||
|
|
||||||
|
**-ov, \-\-override, -override**
|
||||||
|
: Automatically override the lock that prevents two loadups from running simultaneously. If this flag is not set and an active lock is encountered, the user will be asked to choose whether to override or exit.
|
||||||
|
|
||||||
**-nc, \-\-nocopy, -nocopy**
|
**-nc, \-\-nocopy, -nocopy**
|
||||||
: Run the specified loadups, but do not copy results into loadups directory.
|
: Run the specified loadups, but do not copy results into loadups directory.
|
||||||
|
|
||||||
|
|||||||
@@ -77,12 +77,15 @@ into the loadups directory.</p></li>
|
|||||||
work directory to the loadups directory if the loadup is successful.
|
work directory to the loadups directory if the loadup is successful.
|
||||||
Each stage of the loadup also creates a dribble file containing the
|
Each stage of the loadup also creates a dribble file containing the
|
||||||
terminal output from within the Medley environment. These dribble files
|
terminal output from within the Medley environment. These dribble files
|
||||||
are not copied to the loadups directory, but remain available in the
|
are also copied to the loadups directory, but also remain available in
|
||||||
work directory after the loadup completes.</p>
|
the work directory after the loadup completes.</p>
|
||||||
<p>Only one instance (per <MEDLEIDIR>) of loadup can be run at a
|
<p>Only one instance (per <MEDLEIDIR>) of loadup can be run at a
|
||||||
time. (The lock file is in the work directory and is named
|
time. There is lock file to prevent simultaneous loadups in the work
|
||||||
<strong><em>lock</em></strong>. It can be removed in case of an
|
directory (named <strong><em>lock</em></strong>) that can be manually
|
||||||
uncontrolled failure of the loadup procedure.)</p>
|
removed. The lock can also be automatically overridden (see the
|
||||||
|
–override flag below). Alternatively, if a lock is encountered at run
|
||||||
|
time, the user will be asked to choose whether to override or simply
|
||||||
|
exit the loadup.</p>
|
||||||
<p>Note: <strong>MEDLEYDIR</strong> is an environment variable set by
|
<p>Note: <strong>MEDLEYDIR</strong> is an environment variable set by
|
||||||
the loadup script. It is set to the top level directory of the Medley
|
the loadup script. It is set to the top level directory of the Medley
|
||||||
installation that contains the specific loadup script that is invoked
|
installation that contains the specific loadup script that is invoked
|
||||||
@@ -194,6 +197,13 @@ loadups.</p>
|
|||||||
<dd>
|
<dd>
|
||||||
<p>Synonym for “–target apps”</p>
|
<p>Synonym for “–target apps”</p>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt><strong>-ov, --override, -override</strong></dt>
|
||||||
|
<dd>
|
||||||
|
<p>Automatically override the lock that prevents two loadups from
|
||||||
|
running simultaneously. If this flag is not set and an active lock is
|
||||||
|
encountered, the user will be asked to choose whether to override or
|
||||||
|
exit.</p>
|
||||||
|
</dd>
|
||||||
<dt><strong>-nc, --nocopy, -nocopy</strong></dt>
|
<dt><strong>-nc, --nocopy, -nocopy</strong></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<p>Run the specified loadups, but do not copy results into loadups
|
<p>Run the specified loadups, but do not copy results into loadups
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ main() {
|
|||||||
nocopy=false
|
nocopy=false
|
||||||
thinw=false
|
thinw=false
|
||||||
thinl=false
|
thinl=false
|
||||||
|
override_lock=false
|
||||||
while [ "$#" -ne 0 ];
|
while [ "$#" -ne 0 ];
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -144,6 +145,9 @@ main() {
|
|||||||
export MAIKODIR="${maikodir}"
|
export MAIKODIR="${maikodir}"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-ov | -override | --override)
|
||||||
|
override_lock=true
|
||||||
|
;;
|
||||||
--noendmsg)
|
--noendmsg)
|
||||||
noendmsg=true
|
noendmsg=true
|
||||||
;;
|
;;
|
||||||
@@ -251,7 +255,7 @@ main() {
|
|||||||
|
|
||||||
|
|
||||||
# check and set the run_lock
|
# 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
|
# if requested, thin the loadups and workdirs by eliminating all versioned (*.~[0-9]*~) files
|
||||||
# from these directories
|
# from these directories
|
||||||
@@ -348,18 +352,24 @@ main() {
|
|||||||
then
|
then
|
||||||
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/lisp.sysout "${LOADUP_OUTDIR}" \
|
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/lisp.sysout "${LOADUP_OUTDIR}" \
|
||||||
| sed -e "s#${MEDLEYDIR}/##g"
|
| sed -e "s#${MEDLEYDIR}/##g"
|
||||||
|
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/lisp.dribble "${LOADUP_OUTDIR}" \
|
||||||
|
| sed -e "s#${MEDLEYDIR}/##g"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $start -le 3 ] && [ $end -ge 4 ]
|
if [ $start -le 3 ] && [ $end -ge 4 ]
|
||||||
then
|
then
|
||||||
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/full.sysout "${LOADUP_OUTDIR}" \
|
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/full.sysout "${LOADUP_OUTDIR}" \
|
||||||
| sed -e "s#${MEDLEYDIR}/##g"
|
| sed -e "s#${MEDLEYDIR}/##g"
|
||||||
|
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/full.dribble "${LOADUP_OUTDIR}" \
|
||||||
|
| sed -e "s#${MEDLEYDIR}/##g"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $start -le 4 ] && [ $end -ge 5 ]
|
if [ $start -le 4 ] && [ $end -ge 5 ]
|
||||||
then
|
then
|
||||||
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/apps.sysout "${LOADUP_OUTDIR}" \
|
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/apps.sysout "${LOADUP_OUTDIR}" \
|
||||||
| sed -e "s#${MEDLEYDIR}/##g"
|
| sed -e "s#${MEDLEYDIR}/##g"
|
||||||
|
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/apps.dribble "${LOADUP_OUTDIR}" \
|
||||||
|
| sed -e "s#${MEDLEYDIR}/##g"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${aux}" = true ]
|
if [ "${aux}" = true ]
|
||||||
@@ -368,12 +378,18 @@ main() {
|
|||||||
| sed -e "s#${MEDLEYDIR}/##g"
|
| sed -e "s#${MEDLEYDIR}/##g"
|
||||||
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/exports.all "${LOADUP_OUTDIR}" \
|
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/exports.all "${LOADUP_OUTDIR}" \
|
||||||
| sed -e "s#${MEDLEYDIR}/##g"
|
| 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
|
fi
|
||||||
|
|
||||||
if [ "${db}" = true ]
|
if [ "${db}" = true ]
|
||||||
then
|
then
|
||||||
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/fuller.database "${LOADUP_OUTDIR}" \
|
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/fuller.database "${LOADUP_OUTDIR}" \
|
||||||
| sed -e "s#${MEDLEYDIR}/##g"
|
| sed -e "s#${MEDLEYDIR}/##g"
|
||||||
|
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/fuller.dribble "${LOADUP_OUTDIR}" \
|
||||||
|
| sed -e "s#${MEDLEYDIR}/##g"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -249,13 +249,39 @@ process_maikodir() {
|
|||||||
export LOADUP_LOCKFILE="${LOADUP_WORKDIR}"/lock
|
export LOADUP_LOCKFILE="${LOADUP_WORKDIR}"/lock
|
||||||
|
|
||||||
check_run_lock() {
|
check_run_lock() {
|
||||||
if [ -e "${LOADUP_LOCKFILE}" ]
|
set +x
|
||||||
then
|
if [ -e "${LOADUP_LOCKFILE}" ]
|
||||||
output_error_msg "Error: Another loadup is already running with PID $(cat "${LOADUP_LOCKFILE}")${EOL}Exiting."
|
then
|
||||||
exit 1
|
output_warn_msg "Warning: Another loadup is already running with PID $(cat "${LOADUP_LOCKFILE}")"
|
||||||
fi
|
if [ "${override_lock}" = true ]
|
||||||
echo "$$" > "${LOADUP_LOCKFILE}"
|
then
|
||||||
LOADUP_LOCK="$$"
|
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() {
|
remove_run_lock() {
|
||||||
|
|||||||
Reference in New Issue
Block a user