#!/bin/sh

APP_NAME=rfsd
if dirname "$0" 1>/dev/null 2>/dev/null; then
    SH_DIR="$(cd "$(dirname "$0")";pwd)"
    cd $SH_DIR
fi
. ./$APP_NAME-inc.sh
init_env

if [ -f /${TMP_DIR}/$APP_NAME-daemon.pid ]; then
   $sudoprefix kill `cat /${TMP_DIR}/$APP_NAME-daemon.pid`
   $sudoprefix rm /${TMP_DIR}/$APP_NAME-daemon.pid
fi

if [ x"$TOS" = x"Darwin" ]; then
    ps ax | grep $APP_NAME-daemon | grep -v grep | cut -d " " -f 1 | $sudoprefix xargs kill 2>/dev/null
fi

$sudoprefix killall $APP_NAME 2>/dev/null
sleep 2 2>/dev/null
$sudoprefix killall -9 $APP_NAME 2>/dev/null

