my-notes-viewer/scripts/deploy.sh

41 lines
891 B
Bash
Raw Normal View History

2021-03-22 15:59:05 +01:00
#!/bin/sh
host=$1
user=$2
pass=$3
if [ "$host" == "" ]; then
echo "missing host"
exit 1
fi
if [ "$user" == "" ]; then
echo "missing username"
exit 1
fi
if [ "$pass" == "" ]; then
echo "missing password"
exit 1
fi
echo "sync frontend"
rsync -rlcgD --perms -i -u -v --stats --progress \
--delete \
-e "sshpass -p $pass ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 22222" \
dist/ \
$user@$host:./frontend/
echo "sync api config"
rsync -rlcgD --perms -i -u -v --stats --progress \
--delete \
-e "sshpass -p $pass ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 22222" \
api/ \
$user@$host:./api/
echo "create media directory"
mkdir media
chmod 770 media
rsync -rlcgD --perms -i -u -v --stats --progress \
-e "sshpass -p $pass ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 22222" \
media \
$user@$host:./