-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| # Systemd unit file for mqtt input script | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
|
||
| # INSTALL: | ||
| # sudo cp /var/www/emoncms/scripts/feedwriter.service /etc/systemd/system/feedwriter.service | ||
|
|
||
| # sudo ln -s /var/www/emoncms/scripts/services/feedwriter/feedwriter.service /lib/systemd/system | ||
|
|
||
| # RUN AT STARTUP | ||
| # sudo systemctl daemon-reload | ||
This comment has been minimized.
Sorry, something went wrong.
borpin
Contributor
|
||
|
|
@@ -12,9 +13,14 @@ | |
| # sudo systemctl stop feedwriter | ||
|
|
||
| # VIEW STATUS / LOG | ||
| # If Using Syslog: | ||
| # sudo systemctl status feedwriter -n50 | ||
| # where -nX is the number of log lines to view | ||
| # sudo journalctl -f -u feedwriter -o cat | grep emontx | ||
| # sudo journalctl -f -u feedwriter | ||
| # Otherwise: | ||
| # Specify | ||
| #StandardOutput=file:/var/log/feedwriter.log | ||
| # tail -f /var/log/feedwriter.log | ||
|
|
||
| ### | ||
| # | ||
|
|
@@ -29,28 +35,28 @@ | |
|
|
||
| [Unit] | ||
| Description=Emoncms MQTT Input Script | ||
This comment has been minimized.
Sorry, something went wrong. |
||
| After=mosquitto.service mysql.service redis.service | ||
| Wants=mysql.service redis.service | ||
| After=mysql.service redis.service | ||
| Documentation=https://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT.md | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
|
||
| # Uncomment this line to use a dedicated log file for StdOut and StdErr. | ||
| # NOTE: only works in systemd v236+ | ||
| # Debain "stretch" includes v232, "buster" includes v239 | ||
| #StandardOutput=file:/var/log/feedwriter.log | ||
|
|
||
| [Service] | ||
| Type=idle | ||
This comment has been minimized.
Sorry, something went wrong.
borpin
Contributor
|
||
| ExecStart=/usr/bin/php /var/www/emoncms/scripts/feedwriter.php | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
|
||
| # Uncomment instead of above to use standard log file, else use systemd log | ||
| # Type=forking | ||
| # ExecStart=/bin/sh -c '/usr/bin/php /var/www/emoncms/scripts/feedwriter.php 2>&1 > /var/log/feedwriter.log &' | ||
|
|
||
| # Restart script if stopped | ||
| Restart=always | ||
| # Wait 60s before restart | ||
| RestartSec=60 | ||
|
|
||
| # Tag things in the log | ||
| # If you want to use the journal instead of the file above, uncomment SyslogIdentifier below | ||
| # View with: sudo journalctl -f -u feedwriter -o cat | ||
| SyslogIdentifier=feedwriter | ||
|
|
||
| # Un-comment to pipe log to syslog | ||
| #StandardOutput=syslog | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Feedwriter | ||
|
|
||
| The feedwriter service writes emoncms feed data to disk when redisbuffer is enabled in settings.php. Feed data is buffered and saved to disk in a more efficent use of block writes than would otherwise be the case, reducing disk wear. This is particularly important on systems running of SD cards. | ||
|
|
||
| ## Install feedwriter service | ||
|
|
||
| If you are not running EmonCMS on Raspbian, modify the .service file to run the service | ||
| as an appropriate user. The service is configured to run as the user 'pi' by default. | ||
| Install the service using the following commands: | ||
| ``` | ||
| sudo ln -s /var/www/emoncms/scripts/services/feedwriter/feedwriter.service /lib/systemd/system | ||
| sudo systemctl daemon-reload | ||
This comment has been minimized.
Sorry, something went wrong. |
||
| sudo systemctl enable feedwriter.service | ||
| sudo systemctl start feedwriter.service | ||
| systemctl status feedwriter.service | ||
| ``` | ||
|
|
||
| View the log with: | ||
| `journalctl -f -u feedwriter` | ||
|
|
||
| Tested on Raspiban Stretch | ||
1 comment
on commit 136166b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The readme needs instructions on how to modify existing systems (starting with a check to see if feedwriter is installed) before installing this service file. Any impact on a running system while this is being done shopuld also be explained (like stopping services, data loss etc).
Change this line