-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·52 lines (38 loc) · 1.05 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /bin/bash
echo Deploying code $1 | ts
echo stopping service | ts
sudo systemctl stop tefnut.service
/home/marco/.local/bin/poetry install
/home/marco/.local/bin/poetry run pip install RPi.GPIO ## Lib only available on rPI
echo Starting service| ts
sudo systemctl start tefnut.service
echo checking status| ts
if (! sudo systemctl -q is-active tefnut.service)
then
echo "Application failed to start"| ts
exit -1
else
echo "Application started"| ts
fi
echo sleeping 60 seconds| ts
sleep 60
echo ===============================================
journalctl -n 30 -u tefnut.service
echo ===============================================
echo checking version| ts
if (journalctl -n 30 -u tefnut.service | grep -q $1 )
then
echo "Good version started"| ts
else
echo "Not on good version"| ts
exit -1
fi
echo checking status| ts
if (! sudo systemctl -q is-active tefnut.service)
then
echo "Application failed after 10 seconds"| ts
exit -1
else
echo "Application started after 10 seconds"| ts
fi
echo done| ts