summaryrefslogtreecommitdiff
path: root/doc/darcs-cm
blob: 2f9af8feceb3377255160ade743a2e01af58890e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

DARCS=`which darcs`
SSH=`which ssh`
REPOSERVER=gfreposerver

if [ ! -x "$SSH" ]; then
  echo "ssh ($SSH): command not found" 1>&2
  exit 1
fi

if [ "$1" = "--stop" ]; then
  $SSH -O exit "$REPOSERVER"
  exit $?
fi

if [ ! -x "$DARCS" ]; then
  echo "darcs ($DARCS): command not found" 1>&2
  exit 1
fi

if ! $SSH -O check "$REPOSERVER" >& /dev/null; then
  echo "Connection to $REPOSERVER is down, connecting..."
  $SSH -f -M "$REPOSERVER" \
     "bash -c 'while true; do echo -n .; sleep 30; done'" > /dev/null
  sleep 1
fi

exec $DARCS "$@"