#!/bin/bash

tbp=/usr/local/ngrok

cmd=$1


if [[ -z $cmd ]];then
        echo "err!usage{sh $0 1|0 to start or shutdown the ngrok.}"
elif [[ $cmd -eq 1 ]];then
        nohup $tbp/bin/ngrokd -tlsKey=$tbp/server.key -tlsCrt=$tbp/server.crt -domain="ykmimi.com" -httpAddr=":80" -httpsAddr=":443" > listen.log 2>&1 &
        echo 'Start Success!~~~'
        # $tbp/bin/ngrokd -domain="ykmimi.com" -httpAddr=":80" -httpsAddr=":443"
elif [[ $cmd -eq 0 ]];then
        echo "todo shutdown"
else
       echo "err!just 1 or 0 behind $0,like(sh $0 1)"
fi