Keep-alive script for SSHD?

Yeah, it’s the same issue as in this thread regarding VNC connection dropouts.

The VNC script which works is below ( I set it to restart every 6 minutes because the dropouts are frequent):

#!/bin/bash
PROGRAM=/boot/home/config/bin/vncserver
$PROGRAM &
PID=$!
echo $PID > /boot/home/config/settings/vnc.pid
sleep 6m
for line in $(cat /boot/home/config/settings/vnc.pid)
do
echo
done
kill $line
launchvnc &

Because SSHD drops out as well, I tried the same script as above for SSHD, but the script doesn’t restart it. It does start SSHD on initial boot-up (I have the VNC and SSHD scripts to launch on boot-up), but running “ps” later in Terminal always shows SSHD as the same PID, even though the script’s own PID changes. Eventually the SSHD connection will no longer work, at random intervals. I put a copy of sshd in /boot/home/config/non-packaged. Here’s the script:

#!/bin/bash
PROGRAM=/boot/home/config/non-packaged/bin/sshd
$PROGRAM &
PID=$!
echo $PID > /boot/home/config/settings/sshd.pid
sleep 7m
for line in $(cat /boot/home/config/settings/sshd.pid)
do
echo
done
kill $line
launchsshd &