42 lines
1.0 KiB
Markdown
42 lines
1.0 KiB
Markdown
# Weather Station
|
|
|
|
Code for the indoor Weather Station
|
|
|
|
## Step 1: Install and Pass the "Variable"
|
|
|
|
Move the template file to the system folder and reload the daemon:
|
|
|
|
* `sudo cp weather-station@.service /etc/systemd/system/`
|
|
* `sudo systemctl daemon-reload`
|
|
|
|
---
|
|
|
|
## Step 2: Enable and Start
|
|
|
|
Now, when you enable and start the service, you **append your actual username** right after the `@` symbol.
|
|
|
|
If your username was `pi-user`:
|
|
|
|
* **Enable it to start on boot:**
|
|
|
|
`sudo systemctl enable weather-station@pi-user.service`
|
|
* **Start the script right now:**
|
|
|
|
`sudo systemctl start weather-station@pi-user.service`
|
|
|
|
---
|
|
|
|
## Step 3: How to check on it
|
|
|
|
* **To see if it's running:**
|
|
|
|
`sudo systemctl status weather-station@pi-user.service`
|
|
* **To read the live console output (like seeing the print statements):**
|
|
|
|
`sudo journalctl -u weather-station@pi-user.service -f`
|
|
*(Press `Ctrl+C` to exit the log view)*
|
|
|
|
* **To manually restart it (if you update your code):**
|
|
|
|
`sudo systemctl restart weather-station@pi-user.service`
|