djm@openbsd.org | dd36932 | 2017-04-30 23:34:55 +0000 | [diff] [blame] | 1 | # $OpenBSD: reconfigure.sh,v 1.6 2017/04/30 23:34:55 djm Exp $ |
Darren Tucker | fc8a7ea | 2003-06-18 22:18:57 +1000 | [diff] [blame] | 2 | # Placed in the Public Domain. |
| 3 | |
| 4 | tid="simple connect after reconfigure" |
| 5 | |
| 6 | # we need the full path to sshd for -HUP |
Damien Miller | bd58853 | 2015-02-25 16:58:22 -0800 | [diff] [blame] | 7 | if 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 |
| 16 | fi |
Darren Tucker | fc8a7ea | 2003-06-18 22:18:57 +1000 | [diff] [blame] | 17 | |
| 18 | start_sshd |
| 19 | |
markus@openbsd.org | 6c43b48 | 2015-01-14 09:54:38 +0000 | [diff] [blame] | 20 | trace "connect before restart" |
djm@openbsd.org | dd36932 | 2017-04-30 23:34:55 +0000 | [diff] [blame] | 21 | ${SSH} -F $OBJ/ssh_config somehost true |
| 22 | if [ $? -ne 0 ]; then |
| 23 | fail "ssh connect with failed before reconfigure" |
| 24 | fi |
markus@openbsd.org | 6c43b48 | 2015-01-14 09:54:38 +0000 | [diff] [blame] | 25 | |
Tim Rice | 722b8d1 | 2010-08-12 09:43:13 -0700 | [diff] [blame] | 26 | PID=`$SUDO cat $PIDFILE` |
Darren Tucker | cb6ecde | 2005-11-12 21:30:07 +1100 | [diff] [blame] | 27 | rm -f $PIDFILE |
| 28 | $SUDO kill -HUP $PID |
Darren Tucker | fc8a7ea | 2003-06-18 22:18:57 +1000 | [diff] [blame] | 29 | |
| 30 | trace "wait for sshd to restart" |
| 31 | i=0; |
| 32 | while [ ! -f $PIDFILE -a $i -lt 10 ]; do |
| 33 | i=`expr $i + 1` |
| 34 | sleep $i |
| 35 | done |
| 36 | |
| 37 | test -f $PIDFILE || fatal "sshd did not restart" |
| 38 | |
markus@openbsd.org | 6c43b48 | 2015-01-14 09:54:38 +0000 | [diff] [blame] | 39 | trace "connect after restart" |
djm@openbsd.org | dd36932 | 2017-04-30 23:34:55 +0000 | [diff] [blame] | 40 | ${SSH} -F $OBJ/ssh_config somehost true |
| 41 | if [ $? -ne 0 ]; then |
| 42 | fail "ssh connect with failed after reconfigure" |
| 43 | fi |