mirror of
https://github.com/pimoroni/grow-python
synced 2025-10-25 15:19:23 +00:00
Add grow system service
This commit is contained in:
14
service/README.md
Normal file
14
service/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Grow Service
|
||||
|
||||
This script will install Grow as a service on your Raspberry Pi, allowing it to run from boot and recover from errors.
|
||||
|
||||
# Useful Commands
|
||||
|
||||
* View service status: `systemctl status grow-monitor`
|
||||
* Stop service: `sudo systemctl stop grow-monitor`
|
||||
* Start service: `sudo systemctl start grow-monitor`
|
||||
* View full debug/error output: `journalctl --no-pager --unit grow-monitor`
|
||||
|
||||
# Configuring Grow
|
||||
|
||||
You can configure grow using the on-screen UI, or by editing the settings in `/etc/default/grow`
|
||||
14
service/grow-monitor.service
Normal file
14
service/grow-monitor.service
Normal file
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Grow Monitoring Service
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/usr/share/grow-monitor
|
||||
ExecStart=/usr/bin/grow-monitor /etc/default/grow
|
||||
Restart=on-failure
|
||||
StandardOutput=syslog+console
|
||||
StandardError=syslog+console
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
40
service/install.sh
Executable file
40
service/install.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
user_check() {
|
||||
if [ $(id -u) -ne 0 ]; then
|
||||
printf "Script must be run as root. Try 'sudo ./install.sh'\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
success() {
|
||||
echo -e "$(tput setaf 2)$1$(tput sgr0)"
|
||||
}
|
||||
|
||||
inform() {
|
||||
echo -e "$(tput setaf 6)$1$(tput sgr0)"
|
||||
}
|
||||
|
||||
warning() {
|
||||
echo -e "$(tput setaf 1)$1$(tput sgr0)"
|
||||
}
|
||||
|
||||
user_check
|
||||
|
||||
inform "Copying icons to /usr/share/grow-monitor...\n"
|
||||
mkdir -p /usr/share/grow-monitor/icons
|
||||
cp ../examples/icons/* /usr/share/grow-monitor/icons
|
||||
|
||||
inform "Installing grow-monitor to /usr/bin/grow-monitor...\n"
|
||||
cp ../examples/monitor.py /usr/bin/grow-monitor
|
||||
chmod +x /usr/bin/grow-monitor
|
||||
|
||||
inform "Installing settings to /etc/default/grow...\n"
|
||||
cp ../examples/settings.yml /etc/default/grow
|
||||
|
||||
inform "Installing systemd service...\n"
|
||||
cp grow-monitor.service /etc/systemd/system/
|
||||
systemctl reenable grow-monitor.service
|
||||
systemctl start grow-monitor.service
|
||||
|
||||
inform "\nTo see grow debug output, run: \"journalctl --no-pager --unit grow-monitor\"\n"
|
||||
Reference in New Issue
Block a user