The output below is from a host behind a firewall
user@rig04:~$ cat reverse_ssh.sh
#!/bin/bash
COMMAND="ssh -p8022 -N -f -R 0.0.0.0:18022:localhost:22 user1@host1
pgrep -f -x "$COMMAND" > /dev/null 2>&1 || $COMMAND
user1/host1 are in host accessible from the internet, public key authenticaion.