diff --git a/docs/man-page/man_medley.html b/docs/man-page/man_medley.html
index e75ac6bed..a0e6c58ae 100644
--- a/docs/man-page/man_medley.html
+++ b/docs/man-page/man_medley.html
@@ -284,6 +284,15 @@
Flags
On Windows/Cygwin installations, FILE is specified in the
Medley file system, not the host Windows file system.
+-am, –automation
+
+Useful only when using –vnc (and always on WSL1). When calling medley
+as part of an automation script, often Medley will run for a very short
+time (< a couple of seconds). This can cause issues with medley code
+that detects Xvnc server failures. Setting this flag notifies Medley
+that very short Medley sessions are possible and the Xvnc error
+detection needs to be adjusted accordingly.
+
Other Options
diff --git a/docs/man-page/medley.1 b/docs/man-page/medley.1
index c2da6a5d3..c73c1f9c1 100644
--- a/docs/man-page/medley.1
+++ b/docs/man-page/medley.1
@@ -386,6 +386,15 @@ environment variable LDEREPEATCM.
On Windows/Cygwin installations, \f[I]FILE\f[R] is specified in the
Medley file system, not the host Windows file system.
.RE
+.TP
+-am, \[en]automation
+Useful only when using \[en]vnc (and always on WSL1).
+When calling medley as part of an automation script, often Medley will
+run for a very short time (< a couple of seconds).
+This can cause issues with medley code that detects Xvnc server
+failures.
+Setting this flag notifies Medley that very short Medley sessions are
+possible and the Xvnc error detection needs to be adjusted accordingly.
.SS Other Options
.PP
\
diff --git a/docs/man-page/medley.1.gz b/docs/man-page/medley.1.gz
index 4e563a85f..95dd0cf33 100644
Binary files a/docs/man-page/medley.1.gz and b/docs/man-page/medley.1.gz differ
diff --git a/docs/man-page/medley.1.md b/docs/man-page/medley.1.md
index 282159649..425e6a30a 100644
--- a/docs/man-page/medley.1.md
+++ b/docs/man-page/medley.1.md
@@ -216,7 +216,7 @@ specified in the Medley file system, not the host Windows file system.
If the given value is "-", Medley will start up without using REM.CM file.
There is no default Medley REM.CM file.
-
+
On Windows/Cygwin installations, *FILE* is
specified in the Medley file system, not the host Windows file system.
@@ -254,10 +254,15 @@ for the parameter will be reset to the default value - which in the case of *Hos
-cc \[*FILE* | -], \-\-repeat \[*FILE* | -]
: Run Medley once. And then as long as *FILE* exists and is greater then zero length, repeatedly run Medley using *FILE* as the REM.CM file that Medley reads and executes at startup. Each run of Medley can change the contents of *FILE* to effect the subsequent run of Medley. To end the cycle, Medley needs to delete *FILE*. WIthin Medley, *FILE* can be found as the value of the environment variable LDEREPEATCM.
-
+
On Windows/Cygwin installations, *FILE* is
specified in the Medley file system, not the host Windows file system.
+-am, --automation
+: Useful only when using --vnc (and always on WSL1). When calling medley as part of an automation script, often Medley
+will run for a very short time (< a couple of seconds). This can cause issues with medley code that detects Xvnc server failures.
+Setting this flag notifies Medley that very short Medley sessions are possible and the Xvnc error detection needs to be adjusted accordingly.
+
Other Options
-------------
diff --git a/scripts/loadups/loadup b/scripts/loadups/loadup
index 0a55b2104..ab84791e7 100755
--- a/scripts/loadups/loadup
+++ b/scripts/loadups/loadup
@@ -18,6 +18,7 @@ main() {
thinw=false
thinl=false
override_lock=false
+ ignore_lock=false
while [ "$#" -ne 0 ];
do
case "$1" in
@@ -148,9 +149,19 @@ main() {
-ov | -override | --override)
override_lock=true
;;
+ --ignore_lock)
+ # internal
+ ignore_lock=true
+ ;;
--noendmsg)
+ # internal
noendmsg=true
;;
+ --forcevnc)
+ # internal - for testing
+ # WSL only -otherwise warning msg from medley
+ force_vnc="+"
+ ;;
-z | -man | --man )
if [ "$(uname)" = "Darwin" ]
then
@@ -284,7 +295,7 @@ main() {
fi
#
- # Do individual loadups as requested
+ # Do individual "stage" loadups as requested
#
if [ "${no_loadups}" = false ]
@@ -318,23 +329,11 @@ main() {
/bin/sh "${LOADUP_SCRIPTDIR}/loadup-apps-from-full.sh"
exit_if_failure $? "${noendmsg}"
fi
-
- if [ "${aux}" = true ]
- then
- /bin/sh "${LOADUP_SCRIPTDIR}/loadup-aux.sh"
- exit_if_failure $? "${noendmsg}"
- fi
-
- if [ "${db}" = true ]
- then
- /bin/sh "${LOADUP_SCRIPTDIR}/loadup-db-from-full.sh"
- exit_if_failure $? "${noendmsg}"
- fi
fi
#
- # Done with loadups, successfully. Now copy files into loadups dir from workdir
+ # Done with "stage" loadups, successfully. Now copy the stages files into loadups dir from workdir
#
if [ "${nocopy}" = false ]
@@ -371,7 +370,29 @@ main() {
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/apps.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
+ fi
+
+
+
+ #
+ # Now do the "after stages" loadups, if required. Do the copies as necessary to meet the dependecies
+ # of one loadup on another's output.
+ #
+
+ # First aux
+
+ if [ "${no_loadups}" = false ]
+ then
+ if [ "${aux}" = true ]
+ then
+ /bin/sh "${LOADUP_SCRIPTDIR}/loadup-aux.sh"
+ exit_if_failure $? "${noendmsg}"
+ fi
+ fi
+
+ if [ "${nocopy}" = false ]
+ then
if [ "${aux}" = true ]
then
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/whereis.hash "${LOADUP_OUTDIR}" \
@@ -383,7 +404,21 @@ main() {
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/exports.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
+ fi
+
+ # then db, which depends on the output of aux
+
+ if [ "${no_loadups}" = false ]
+ then
+ if [ "${db}" = true ]
+ then
+ /bin/sh "${LOADUP_SCRIPTDIR}/loadup-db-from-full.sh"
+ exit_if_failure $? "${noendmsg}"
+ fi
+ fi
+ if [ "${nocopy}" = false ]
+ then
if [ "${db}" = true ]
then
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/fuller.database "${LOADUP_OUTDIR}" \
@@ -391,9 +426,12 @@ main() {
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/fuller.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
-
fi
+
+ #
+ # OK we're done, exit cleanly
+ #
echo "+++++ loadup: SUCCESS +++++"
remove_run_lock
exit 0
diff --git a/scripts/loadups/loadup-aux.sh b/scripts/loadups/loadup-aux.sh
index f2301d106..c16182519 100755
--- a/scripts/loadups/loadup-aux.sh
+++ b/scripts/loadups/loadup-aux.sh
@@ -8,6 +8,13 @@ main() {
loadup_start
+ SYSOUT="${LOADUP_OUTDIR}/full.sysout"
+ if [ ! -f "${SYSOUT}" ]
+ then
+ output_error_msg "Error: cannot find ${SYSOUT}.${EOL}Exiting."
+ exit 1
+ fi
+
initfile="-"
cat >"${cmfile}" <<-"EOF"
"
@@ -33,7 +40,7 @@ main() {
"
EOF
- run_medley "${LOADUP_WORKDIR}/full.sysout"
+ run_medley "${SYSOUT}"
loadup_finish "whereis.hash" "whereis.hash" "exports.all"
}
diff --git a/scripts/loadups/loadup-db-from-full.sh b/scripts/loadups/loadup-db-from-full.sh
index fef9535e7..39f016fbb 100755
--- a/scripts/loadups/loadup-db-from-full.sh
+++ b/scripts/loadups/loadup-db-from-full.sh
@@ -6,13 +6,21 @@ main() {
loadup_start
- SYSOUT="${MEDLEYDIR}/loadups/full.sysout"
- if [ ! -f "${SYSOUT}" ];
+ SYSOUT="${LOADUP_OUTDIR}/full.sysout"
+ if [ ! -f "${SYSOUT}" ]
then
output_error_msg "Error: cannot find ${SYSOUT}.${EOL}Exiting."
exit 1
fi
+ # Check to make sure exports.all exists and is newer than full.sysout
+ # if not, run loadup-aux to create a new exports.all
+ EXPORTS="${LOADUP_OUTDIR}/exports.all"
+ if [ ! -f "${EXPORTS}" ] || [ "$(find "${SYSOUT}" -newer "${EXPORTS}" -exec echo true \; )" = true ]
+ then
+ "${MEDLEYDIR}"/scripts/loadups/loadup --aux --ignore_lock --noendmsg
+ fi
+
initfile="-"
cat >"${cmfile}" <<-"EOF"
"
diff --git a/scripts/loadups/loadup-setup.sh b/scripts/loadups/loadup-setup.sh
index e1e102964..0177dd084 100644
--- a/scripts/loadups/loadup-setup.sh
+++ b/scripts/loadups/loadup-setup.sh
@@ -161,6 +161,7 @@ loadup_finish () {
exit ${exit_code}
}
+force_vnc="-"
run_medley () {
/bin/sh "${MEDLEYDIR}/scripts/medley/medley.command" \
--config - \
@@ -171,6 +172,8 @@ run_medley () {
--rem.cm "${cmfile}" \
--greet "${initfile}" \
--sysout "$1" \
+ --automation \
+ --vnc "${force_vnc}" \
"$2" "$3" "$4" "$5" "$6" "$7" ;
exit_code=$?
}
@@ -247,9 +250,13 @@ process_maikodir() {
}
export LOADUP_LOCKFILE="${LOADUP_WORKDIR}"/lock
+LOADUP_LOCK=""
+override_lock=false
+ignore_lock=false
check_run_lock() {
- set +x
+ if [ "${ignore_lock}" = false ]
+ then
if [ -e "${LOADUP_LOCKFILE}" ]
then
output_warn_msg "Warning: Another loadup is already running with PID $(cat "${LOADUP_LOCKFILE}")"
@@ -282,6 +289,7 @@ check_run_lock() {
fi
echo "$$" > "${LOADUP_LOCKFILE}"
LOADUP_LOCK="$$"
+ fi
}
remove_run_lock() {
diff --git a/scripts/medley/medley.command b/scripts/medley/medley.command
index 28ce293f7..70a659b0f 100755
--- a/scripts/medley/medley.command
+++ b/scripts/medley/medley.command
@@ -586,6 +586,8 @@ flags:
-x - | --logindir - : use MEDLEYDIR/logindir as LOGINDIR in Medley
+ -am | --automation : this call to medley is being used in automation, adjust timings. Relevant in -vnc case only.
+
-cm FILE | --rem.cm FILE : use FILE as the REM.CM when starting up Medley. FILE must be absolute pathname.
-cm - | --rem.cm - : do not use an REM.CM. Negate any prior setting, e.g., from config file.
@@ -638,6 +640,7 @@ pixelscale_arg=""
borderwidth_arg=""
remcm_arg="${LDEREMCM}"
repeat_cm=""
+automation=false
# Add marker at end of args so we can accumulate pass-on args in args array
set -- "$@" "--start_of_pass_args"
@@ -915,6 +918,9 @@ do
fi
exit 0
;;
+ -am | --automation)
+ automation=true
+ ;;
-nf | -NF | --nofork)
# for use in loadups
case $2 in
@@ -1702,7 +1708,7 @@ do
"$(ip_addr)":"${VNC_PORT}" \
>>"${LOG}" 2>&1 &
wait $!
- if [ $(( $(date +%s) - start_time )) -lt 5 ]
+ if [ "${automation}" = false ] && [ $(( $(date +%s) - start_time )) -lt 5 ]
then
if [ -z "$(pgrep -f "Xvnc ${DISPLAY}")" ]
then
diff --git a/scripts/medley/medley_args.sh b/scripts/medley/medley_args.sh
index eac7baa0e..2c3ec04d5 100755
--- a/scripts/medley/medley_args.sh
+++ b/scripts/medley/medley_args.sh
@@ -48,6 +48,7 @@ pixelscale_arg=""
borderwidth_arg=""
remcm_arg="${LDEREMCM}"
repeat_cm=""
+automation=false
# Add marker at end of args so we can accumulate pass-on args in args array
set -- "$@" "--start_of_pass_args"
@@ -325,6 +326,9 @@ do
fi
exit 0
;;
+ -am | --automation)
+ automation=true
+ ;;
-nf | -NF | --nofork)
# for use in loadups
case $2 in
diff --git a/scripts/medley/medley_usage.sh b/scripts/medley/medley_usage.sh
index e241ab16f..a0346f91b 100644
--- a/scripts/medley/medley_usage.sh
+++ b/scripts/medley/medley_usage.sh
@@ -115,6 +115,8 @@ flags:
-x - | --logindir - : use MEDLEYDIR/logindir as LOGINDIR in Medley
+ -am | --automation : this call to medley is being used in automation, adjust timings. Relevant in -vnc case only.
+
-cm FILE | --rem.cm FILE : use FILE as the REM.CM when starting up Medley. FILE must be absolute pathname.
-cm - | --rem.cm - : do not use an REM.CM. Negate any prior setting, e.g., from config file.
diff --git a/scripts/medley/medley_vnc.sh b/scripts/medley/medley_vnc.sh
index b578f8599..df4f5fb42 100755
--- a/scripts/medley/medley_vnc.sh
+++ b/scripts/medley/medley_vnc.sh
@@ -215,7 +215,7 @@
"$(ip_addr)":"${VNC_PORT}" \
>>"${LOG}" 2>&1 &
wait $!
- if [ $(( $(date +%s) - start_time )) -lt 5 ]
+ if [ "${automation}" = false ] && [ $(( $(date +%s) - start_time )) -lt 5 ]
then
if [ -z "$(pgrep -f "Xvnc ${DISPLAY}")" ]
then