mnml/bin/studios.sh
2020-01-04 17:29:07 +10:00

23 lines
550 B
Bash
Executable File

#!/bin/bash
# bless you chris and andy <3
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
MNML_PATH=$(realpath "$DIR/../")
CLIENT_PUBLIC_DIR="/var/lib/mnml/public/studios"
TARGET=$1
cd $MNML_PATH/studios
rm -rf dist
npm i
npm run build
# client updates
echo "syncing studios"
rsync -a --delete --delete-excluded "$MNML_PATH/studios/dist/" "$TARGET:$CLIENT_PUBLIC_DIR/"
ssh -q "$TARGET" ls -lah "$CLIENT_PUBLIC_DIR"
echo "restarting nginx service"
ssh -q -t "$TARGET" sudo service nginx restart && sleep 1 && systemctl --no-pager status nginx