├── LICENSE ├── MMM-WatchDog.js ├── README.md └── node_helper.js /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Michael Teeuw 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MMM-WatchDog.js: -------------------------------------------------------------------------------- 1 | Module.register("MMM-WatchDog",{ 2 | 3 | // Default module config. 4 | defaults: { 5 | interval: 2, 6 | timeout: 10 7 | }, 8 | 9 | // Override dom generator. 10 | start: function() { 11 | this.sendSocketNotification('SET_CONFIG', this.config); 12 | this.startHeartbeat(); 13 | }, 14 | 15 | // Start the interval to send the PING message. 16 | startHeartbeat: function() { 17 | var self = this; 18 | setInterval(function() { 19 | self.sendSocketNotification('PING', this.config); 20 | }, this.config.interval * 1000); 21 | } 22 | 23 | }); 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MMM-WatchDog 2 | 3 | This MagicMirror² module keeps an eye on your UI and quits app in case the UI crashes. 4 | If you combine this with the [PM2 process manager](https://github.com/MichMich/MagicMirror/wiki/Auto-Starting-MagicMirror#using-pm2), MM2 will automaticly restart after a UI failure. 5 | 6 | ## Installation 7 | 8 | In your terminal, go to your MagicMirror's Module folder: 9 | ```` 10 | cd ~/MagicMirror/modules 11 | ```` 12 | 13 | Clone this repository: 14 | ```` 15 | git clone https://github.com/MichMich/MMM-WatchDog.git 16 | ```` 17 | 18 | Configure the module in your `config.js` file. 19 | 20 | ## Using the module 21 | 22 | To use this module, add it to the modules array in the `config/config.js` file: 23 | ````javascript 24 | modules: [ 25 | { 26 | module: 'MMM-WatchDog', 27 | config: { 28 | // See 'Configuration options' for more information. 29 | } 30 | } 31 | ] 32 | ```` 33 | 34 | ## Configuration options 35 | 36 | The following properties can be configured: 37 | 38 | 39 |
Option | 43 |Description | 44 |
---|---|
interval |
49 | The number of seconds between each Heartbeat.
50 | Default value: 2
51 | |
52 |
timeout |
55 | The timeout in seconds before the MagicMirror² app quits.
56 | Default value: 10
57 | |
58 |