2018-01-12 00:13:18 -05:00
|
|
|
#!/bin/sh
|
2018-01-13 13:18:00 -05:00
|
|
|
if [ "$1" == "" ] ; then
|
2018-01-13 16:51:43 -05:00
|
|
|
PORT=443
|
2018-01-12 00:13:18 -05:00
|
|
|
else
|
|
|
|
PORT=$1
|
|
|
|
fi
|
|
|
|
|
2018-01-13 13:18:00 -05:00
|
|
|
if [ "$2" == "" ]; then
|
2018-01-13 16:51:43 -05:00
|
|
|
REDIRPORT=80
|
2018-01-12 00:13:18 -05:00
|
|
|
else
|
2018-01-13 12:53:18 -05:00
|
|
|
REDIRPORT=$2
|
|
|
|
fi
|
|
|
|
|
2018-01-13 16:51:43 -05:00
|
|
|
if [ "$3" == "" ]; then
|
|
|
|
MPSPORT=4443
|
|
|
|
else
|
|
|
|
MPSPORT=$3
|
|
|
|
fi
|
|
|
|
|
2018-01-13 15:48:35 -05:00
|
|
|
su - meshserver
|
|
|
|
cd /home/meshserver/
|
2018-01-13 12:53:18 -05:00
|
|
|
npm install meshcentral
|
|
|
|
|
2018-01-13 15:48:35 -05:00
|
|
|
if [ -f ssl.key ]; then
|
|
|
|
ln -sf ssl.key meshcentral-data/agentserver-cert-private.key
|
|
|
|
ln -sf ssl.cert meshcentral-data/agentserver-cert-public.crt
|
|
|
|
ln -sf ssl.key meshcentral-data/root-cert-private.key
|
|
|
|
ln -sf ssl.cert meshcentral-data/root-cert-public.crt
|
|
|
|
ln -sf ssl.key meshcentral-data/webserver-cert-private.key
|
|
|
|
ln -sf ssl.cert meshcentral-data/webserver-cert-public.crt
|
|
|
|
ln -sf ssl.key meshcentral-data/mpsserver-cert-private.key
|
|
|
|
ln -sf ssl.cert meshcentral-data/mpsserver-cert-public.crt
|
2018-01-13 16:51:43 -05:00
|
|
|
forever start node_modules/meshcentral/meshcentral.js --port $PORT --redirport $REDIRPORT --mpsport $MPSPORT
|
2018-01-13 15:48:35 -05:00
|
|
|
elif ! [ -f meshcentral-data/agentserver-cert-private.key ] ;then
|
2018-01-13 16:51:43 -05:00
|
|
|
forever start node_modules/meshcentral/meshcentral.js --cert $HOSTNAME --port $PORT --redirport $REDIRPORT --mpsport $MPSPORT
|
2018-01-13 13:18:00 -05:00
|
|
|
else
|
2018-01-13 16:51:43 -05:00
|
|
|
forever start node_modules/meshcentral/meshcentral.js --port $PORT --redirport $REDIRPORT --mpsport $MPSPORT
|
2018-01-12 00:13:18 -05:00
|
|
|
fi
|
|
|
|
|