Skip to content

Commit

Permalink
Merge pull request #15 from pkolmann/master
Browse files Browse the repository at this point in the history
Add systemd unit file and add some desription to README.
  • Loading branch information
sarnau committed Jul 4, 2018
2 parents a1f8132 + 047ef4c commit cc1c4bf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions maserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ Hints for the ```config.json``` keys:
* **serverPost:** set to the POST URL where the JSON data should be sent to
* **serverPostUser**, **serverPostPassword**: Basic Authorization user and password for the POST URL


If you have systemd as your init system, you can copy ```maserver.service``` to ```/etc/systemd/system/```, edit it to match the path where your installation is found. Then you need to reload systemd via ```systemctl daemon-reload``` and start the Unit via ```systemctl start maserver.service```.

23 changes: 23 additions & 0 deletions maserver/maserver.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[Unit]
Description=Mobile Alerts Proxy Server
Documentation=https://github.com/sarnau/MMMMobileAlerts/tree/master/maserver
After=network.target

[Service]
Type=simple

# Update to the username owning the installation
User=USERNAME

# update to the proper path
WorkingDirectory=/PATH/TO/MMMMobileAlerts/maserver
ExecStart=/usr/bin/node /PATH/TO/MMMMobileAlerts/maserver/mobilealerts.js

Restart=on-failure
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=maserver

[Install]
WantedBy=multi-user.target

2 changes: 1 addition & 1 deletion maserver/mobilealerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function sendPOST(sensor) {
console.log("posting data...");
request(options, function (error, response, body) {
if (error || response.statusCode != 200) {
console.log("serverPOST failed: " + response.statusCode + " - " + error);
console.log("serverPOST failed: " + error);
}
});

Expand Down

0 comments on commit cc1c4bf

Please sign in to comment.