-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·31 lines (26 loc) · 1.14 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
ROBOT_NAME=sauron
ROBOT_HOST=${1:-${ROBOT_NAME}}
INSTALL_DIR=/home/pi/$ROBOT_NAME
echo "Compilation ..."
./build-pi.sh
echo "Nettoyage des dossiers"
ssh $ROBOT_HOST sudo systemctl stop $ROBOT_NAME.service
ssh $ROBOT_HOST sudo systemctl stop $ROBOT_NAME-shutdown.service
ssh $ROBOT_HOST mkdir -p $INSTALL_DIR
ssh $ROBOT_HOST rm -vf $INSTALL_DIR/*.sh
ssh $ROBOT_HOST rm -vf $INSTALL_DIR/*.py
echo "Déploiement Applicatif ..."
scp ./build-pi/bin/vision_balise $ROBOT_HOST:$INSTALL_DIR/
scp ./config.yml $ROBOT_HOST:$INSTALL_DIR/
scp ./calibration.yml $ROBOT_HOST:$INSTALL_DIR/
scp -r ./scripts/* $ROBOT_HOST:$INSTALL_DIR/
ssh $ROBOT_HOST mkdir -p $INSTALL_DIR/output
echo "Déploiement service ..."
ssh $ROBOT_HOST sudo mv $INSTALL_DIR/$ROBOT_NAME.service /lib/systemd/system/
ssh $ROBOT_HOST sudo mv $INSTALL_DIR/$ROBOT_NAME-shutdown.service /lib/systemd/system/
ssh $ROBOT_HOST sudo systemctl daemon-reload
ssh $ROBOT_HOST sudo systemctl enable $ROBOT_NAME.service
ssh $ROBOT_HOST sudo systemctl enable $ROBOT_NAME-shutdown.service
ssh $ROBOT_HOST sudo systemctl start $ROBOT_NAME.service
ssh $ROBOT_HOST sudo systemctl start $ROBOT_NAME-shutdown.service