-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
npm stop
for stop MagicMirror process
- Loading branch information
Showing
4 changed files
with
34 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
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,19 @@ | ||
/** Stop MagicMirror from MagicMirror.pid file */ | ||
|
||
const readFile = require("fs").readFile; | ||
|
||
let pid; | ||
readFile("MagicMirror.pid", "utf8", (err, data) => { | ||
if (err) { | ||
console.error("Error reading MagicMirror.pid file"); | ||
console.error(err.message); | ||
} else { | ||
pid = data; | ||
try { | ||
process.kill(pid, "SIGINT"); | ||
console.log(`MagicMirror² killed from process ${pid}`); | ||
} catch (e) { | ||
console.error(`MagicMirror² not found on process ${pid}`); | ||
} | ||
} | ||
}); |
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