-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added systemd service file and setup script
- Loading branch information
Jannik Sven Scharrenbach
committed
Dec 8, 2020
1 parent
ee2b6ce
commit 0aecae5
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
echo "Installing pip requirements..." | ||
python3 -m pip install -r requirements.txt || { echo 'pip install failed' ; exit 1; } | ||
echo "Preparing service..." | ||
sed "s#{INSTALL_DIR}#$(pwd)#" tado-control.service > /tmp/tado-control.service_TMP || { echo 'sed command failed' ; exit 1; } | ||
|
||
echo "Setting up service..." | ||
sudo cp /tmp/tado-control.service_TMP /etc/systemd/system/tado-control.service || { echo 'copy to /tmp failed' ; exit 1; } | ||
sudo systemctl daemon-reload || { echo 'systemctl reload failed' ; exit 1; } | ||
sudo systemctl start tado-control || { echo 'starting the service failed' ; exit 1; } | ||
sudo systemctl enable tado-control || { echo 'enabling the service failed' ; exit 1; } | ||
|
||
rm /tmp/tado-control.service_TMP | ||
|
||
sudo systemctl status tado-control | ||
|
||
echo "Systemd service created successfully." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=Tado individual away control | ||
After=syslog.target network-online.target | ||
|
||
[Service] | ||
Type=simple | ||
User=root | ||
ExecStart=/usr/bin/python3 {INSTALL_DIR}/start.py | ||
Restart=on-failure | ||
RestartSec=10 | ||
KillMode=process | ||
|
||
[Install] | ||
WantedBy=multi-user.target |