22 lines
665 B
Bash
22 lines
665 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
set -e
|
||
|
set -o pipefail
|
||
|
|
||
|
USER=pi
|
||
|
HOST=192.168.0.82
|
||
|
ADDR=$USER@$HOST
|
||
|
|
||
|
echo "Stopping service-ping"
|
||
|
ssh $ADDR "sudo systemctl stop service-ping"
|
||
|
echo "Removing old source"
|
||
|
ssh $ADDR "rm -rf /opt/service-ping/source/*"
|
||
|
echo "Uploading latest source"
|
||
|
scp -r ${PWD}/* $ADDR:/opt/service-ping/source/
|
||
|
echo "Building application"
|
||
|
ssh $ADDR "cd /opt/service-ping/source && /opt/ldc2-1.37.0/bin/dub build --compiler=/opt/ldc2-1.37.0/bin/ldc2 --build=release"
|
||
|
echo "Copying app to final location"
|
||
|
ssh $ADDR "sudo cp -f /opt/service-ping/source/service-ping /opt/service-ping/app"
|
||
|
echo "Starting service-ping"
|
||
|
ssh $ADDR "sudo systemctl start service-ping"
|