29 lines
482 B
Bash
Executable File
29 lines
482 B
Bash
Executable File
#!/bin/sh -x
|
|
|
|
# Written by Simon Josefsson
|
|
|
|
# Start sshd, invoke parameters, saving exit code, kill sshd, and
|
|
# return exit code.
|
|
|
|
cmd="$@"
|
|
SSHD=${SSHD:-/usr/sbin/sshd}
|
|
|
|
$SSHD -f etc/sshd_config -h $PWD/etc/host -D &
|
|
sshdpid=$!
|
|
|
|
trap "kill ${sshdpid}; echo signal killing sshd; exit 1;" EXIT
|
|
|
|
: "started sshd (${sshdpid})"
|
|
|
|
sleep 1
|
|
|
|
: Invoking $cmd...
|
|
eval $cmd
|
|
ec=$?
|
|
: Self-test exit code $ec
|
|
|
|
: "killing sshd (${sshdpid})"
|
|
kill "${sshdpid}" > /dev/null 2>&1
|
|
trap "" EXIT
|
|
exit $ec
|