| WORKER=$(hostname | sed 's|.*-\([0-9]*\)$|\1|') |
| echo "using worker ID $WORKER" |
| if [[ -f ".ssh/id_ecdsa" ]]; then |
| export SUBNET=10.0.$WORKER |
| echo "Checking connectivity to new-ci ..." |
| PIDS=$(ps -a -o pid,ppid,cmd | grep ssh | grep gerrit-ci.gerritforge.com | grep -v grep | awk '{print $1}') |
| if [[ -n "$PIDS" ]] ; then |
| if ping -q -c 1 -w $TIMEOUT $SUBNET.2 > /dev/null |
| echo "no connection; Killing stale PIDs $PIDS" |
| # Ugh. SELinux disallows PPPD to execute SSH. |
| nodetach noauth silent nodeflate pty \ |
| "/usr/bin/ssh -p 1022 gerrit-ci.gerritforge.com /usr/sbin/pppd nodetach notty noauth" ipparam vpn $SUBNET.1:$SUBNET.2 |