summaryrefslogtreecommitdiff
path: root/bin/rtt
blob: c6b9edc23688298ba116dcbd11c5e690cc52ddde (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
30
31
#!/bin/bash

cmd=$1
shift

bindir=$(dirname $(readlink -f $0))

if [ ! -n "$cmd" ]
then
	cmd=help
fi

if [ ! -f ./server.js ]
then
	echo "rtt: command must run in the top-level server directory!"
	exit 1
fi

if [ ! -f $bindir/rtt-$cmd ]
then
	echo "rtt: '$cmd' is not an rtt command"
	exit 1
fi

if [ ! -f ./db -a "$cmd" != init -a "$cmd" != "help" ]
then
	echo "rtt: the database does not exist!"
	exit 1
fi

exec $bindir/rtt-$cmd "$@"