-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
34 lines (26 loc) · 1.01 KB
/
setup.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
# sudo systemctl restart airquality_server
echo "==> Setting up air quality systemd service…"
# install depednecies from pimoroni/enviroplus-python
# this will create a python virtual environment at ~/.virtualenvs/pimoroni/
mkdir -p ~/code
git clone https://github.com/pimoroni/enviroplus-python ~/code
cd ~/code/enviroplus-python
./install.sh
sudo mkdir -p /var/lib/airquality/
sudo cp -rp ~/code/enviroplus-monitor/* /var/lib/airquality/
echo \
"# /etc/systemd/system/airquality_server.service
# to run: sudo systemctl stop/start/restart/enable/disable airquality_server
[Unit]
Description=airQualityDaemon
After=network.target rc-local.service
[Service]
Restart=always
WorkingDirectory=/var/lib/airquality/
ExecStart=sudo ~/.virtualenvs/pimoroni/bin/python enviro.py
[Install]
WantedBy=multi-user.target" | \
sudo tee /etc/systemd/system/airquality_server.service > /dev/null
sudo chmod 644 /etc/systemd/system/airquality_server.service
sudo systemctl start airquality_server
sudo systemctl enable airquality_server