6 DEKIHOST_CONF
="/etc/webapps/mindtouch/mindtouch.host.conf"
9 if [ ! -f $DEKIHOST_CONF ]; then
10 echo "$DEKIHOST_CONF does not exist"
16 # set default values if not specified in $DEKIHOST_CONF
18 if [ ! -f "$MONO" ]; then
19 echo "Please specify the full path to your mono binary"
23 if [ ! -d "$BIN_DIR" ]; then
24 echo "Please specify the path to your MindTouch bin directory"
28 if [ -z "$APIKEY" ]; then
29 echo "Please specify your APIKEY"
33 if [ -z "$PATH_PREFIX" ]; then
37 if [ -z "$HTTP_PORT" ]; then
45 if [ -z "$HOST_EXE" ]; then
46 HOST_EXE
="$BIN_DIR/mindtouch.host.exe"
49 if [ -z "$SCRIPT" ]; then
50 SCRIPT
="/etc/dekiwiki/mindtouch.deki.startup.xml"
53 if [ -z "$NOTTY" ]; then
57 if [ -z "$CONNECT_LIMIT" ]; then
61 if [ -z "$LOGDIR" ]; then
62 LOGDIR
="/var/www/dekiwiki"
65 if [ -z "$LOGFILE" ]; then
66 LOGFILE
="$LOGDIR/deki-api.log"
69 if [ ! -z "$GUID" ]; then
73 if [ ! -z "$STORAGEDIR" ]; then
74 STORAGEDIR
="storage-dir $STORAGEDIR"
78 # we grep on assembly name and port in case multiple mono processes are running
79 echo $
(ps
-U $DEKIWIKI_USER -o pid
,cmd |
grep mindtouch.
host.exe |
grep $HTTP_PORT |
awk '{print $1}')
84 stat_busy
"Stopping MindTouch API"
85 if [ -z "$PID" ]; then
86 echo -n "MindTouch is not running."
90 # attempt to shut down gracefully using curl
91 curl
-m 10 -s -d "" "http://$IP:$HTTP_PORT/host/?apikey=$APIKEY&dream.in.verb=DELETE"
94 # if the host didn't shut down properly then kill it
96 if [ -n "$PID" ]; then
99 # if it still didn't go away, fail
100 PID
=$
(pidof_dekiwiki
)
101 if [ -n "$PID" ]; then
107 rm -f /var
/run
/mindtouch.pid
114 stat_busy
"Starting MindTouch API"
115 if [ ! -d $LOGDIR ]; then
117 chown
$DEKIWIKI_USER $LOGDIR
119 # see if the process is already running
120 PID
=$
(pidof_dekiwiki
)
121 if [ -n "$PID" ]; then
122 echo -n "MindTouch is already running: $PID"
126 MONO_ARGS
="$HOST_EXE apikey $APIKEY script $SCRIPT path-prefix $PATH_PREFIX http-port $HTTP_PORT ip $IP connect-limit $CONNECT_LIMIT $NOTTY $GUID $STORAGEDIR"
127 su
-s /bin
/bash
-c "exec $MONO $MONO_ARGS " $DEKIWIKI_USER >> $LOGFILE 2>&1 &
130 PID
=$
(pidof_dekiwiki
)
131 if [ -z "$PID" ]; then
135 echo "$PID" > /var
/run
/mindtouch.pid
154 echo "Usage: $0 {start|stop|restart}" >&2