summaryrefslogtreecommitdiffstats
path: root/server/lib/wolhelper.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/wolhelper.js')
-rw-r--r--server/lib/wolhelper.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/server/lib/wolhelper.js b/server/lib/wolhelper.js
index 97c0958..c840e44 100644
--- a/server/lib/wolhelper.js
+++ b/server/lib/wolhelper.js
@@ -1,3 +1,6 @@
+/* global __appdir */
+var path = require('path')
+const log = require(path.join(__appdir, 'lib', 'log'))
const wol = require('node-wol')
function wakeUp (clients) {
@@ -8,6 +11,19 @@ function wakeUp (clients) {
if (client.mac !== null && client.ip !== null) {
console.log('Waking up: ' + client.name + ' (' + client.mac + ')')
wol.wake(client.mac, { address: client.ip.slice(0, client.ip.lastIndexOf('.') + 1) + '255' }, err => { if (err) console.log(err) })
+ log({
+ category: 'WAKE_ON_LAN',
+ description: 'Wake on Lan signal sent to client.',
+ client,
+ clientId: client.id
+ })
+ } else {
+ log({
+ category: 'ERROR_WAKE_ON_LAN',
+ description: 'Client is missing ip or mac address.',
+ client,
+ clientId: client.id
+ })
}
i++
if (i < clients.length) loop()