mirror of
https://git.savannah.gnu.org/git/inetutils.git
synced 2026-01-12 00:19:39 +08:00
tests/tftp.sh: Activate job control.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2012-02-05 Mats Erik Andersson <gnu@gisladisker.se>
|
||||
|
||||
* tests/tftp.sh: Need job control, issue `set -m'.
|
||||
(spawned_pid): New variable.
|
||||
<inetd restart failure>: For better robustness, kill process
|
||||
immediately using SPAWNED_PID.
|
||||
|
||||
2012-02-04 Mats Erik Andersson <gnu@gisladisker.se>
|
||||
|
||||
* src/logger.c (unixsock): New variable.
|
||||
|
||||
@@ -21,13 +21,16 @@
|
||||
|
||||
# Prerequisites:
|
||||
#
|
||||
# * Shell: SVR4 Bourne shell, or newer.
|
||||
# * Shell: SVR4 Bourne shell, or newer, and allowing job control.
|
||||
#
|
||||
# * cat(1), expr(1), head(1), kill(1), pwd(1), rm(1).
|
||||
#
|
||||
# * cmp(1), dd(1), id(1), grep(1), mktemp(1), netstat(8),
|
||||
# ps(1), sed(1), uname(1).
|
||||
|
||||
# Need job control when spawning Inetd.
|
||||
set -m
|
||||
|
||||
if [ "$VERBOSE" ]; then
|
||||
set -x
|
||||
fi
|
||||
@@ -175,6 +178,9 @@ test -n "${VERBOSE+yes}" || REDIRECT='2>/dev/null'
|
||||
|
||||
eval "$INETD -d -p'$INETD_PID' '$INETD_CONF' $REDIRECT &"
|
||||
|
||||
# Debug mode allows the shell to recover PID of Inetd.
|
||||
spawned_pid=$!
|
||||
|
||||
sleep 2
|
||||
|
||||
inetd_pid="`cat $INETD_PID 2>/dev/null`" ||
|
||||
@@ -213,6 +219,7 @@ if test $? -ne 0; then
|
||||
}
|
||||
|
||||
$INETD -d -p"$INETD_PID" "$INETD_CONF" &
|
||||
spawned_pid=$!
|
||||
sleep 2
|
||||
inetd_pid="`cat $INETD_PID 2>/dev/null`" ||
|
||||
{
|
||||
@@ -221,6 +228,7 @@ if test $? -ne 0; then
|
||||
but loosing control whether an Inetd process is
|
||||
still around.
|
||||
EOT
|
||||
ps "$spawned_pid" >/dev/null 2>&1 && kill -9 "$spawned_pid" 2>/dev/null
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -230,6 +238,7 @@ if test $? -ne 0; then
|
||||
: # Successful this time.
|
||||
else
|
||||
echo "Failed again at starting correct Inetd instance." >&2
|
||||
ps "$spawned_pid" >/dev/null 2>&1 && kill -9 "$spawned_pid" 2>/dev/null
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user