blob: dd15eddb2a241b1d1e53f129e5bd064fcbf3ab9a [file] [log] [blame]
djm@openbsd.orgdd369322017-04-30 23:34:55 +00001# $OpenBSD: reconfigure.sh,v 1.6 2017/04/30 23:34:55 djm Exp $
Darren Tuckerfc8a7ea2003-06-18 22:18:57 +10002# Placed in the Public Domain.
3
4tid="simple connect after reconfigure"
5
6# we need the full path to sshd for -HUP
Damien Millerbd588532015-02-25 16:58:22 -08007if test "x$USE_VALGRIND" = "x" ; then
8 case $SSHD in
9 /*)
10 # full path is OK
11 ;;
12 *)
13 # otherwise make fully qualified
14 SSHD=$OBJ/$SSHD
15 esac
16fi
Darren Tuckerfc8a7ea2003-06-18 22:18:57 +100017
18start_sshd
19
markus@openbsd.org6c43b482015-01-14 09:54:38 +000020trace "connect before restart"
djm@openbsd.orgdd369322017-04-30 23:34:55 +000021${SSH} -F $OBJ/ssh_config somehost true
22if [ $? -ne 0 ]; then
23 fail "ssh connect with failed before reconfigure"
24fi
markus@openbsd.org6c43b482015-01-14 09:54:38 +000025
Tim Rice722b8d12010-08-12 09:43:13 -070026PID=`$SUDO cat $PIDFILE`
Darren Tuckercb6ecde2005-11-12 21:30:07 +110027rm -f $PIDFILE
28$SUDO kill -HUP $PID
Darren Tuckerfc8a7ea2003-06-18 22:18:57 +100029
30trace "wait for sshd to restart"
31i=0;
32while [ ! -f $PIDFILE -a $i -lt 10 ]; do
33 i=`expr $i + 1`
34 sleep $i
35done
36
37test -f $PIDFILE || fatal "sshd did not restart"
38
markus@openbsd.org6c43b482015-01-14 09:54:38 +000039trace "connect after restart"
djm@openbsd.orgdd369322017-04-30 23:34:55 +000040${SSH} -F $OBJ/ssh_config somehost true
41if [ $? -ne 0 ]; then
42 fail "ssh connect with failed after reconfigure"
43fi