I am running backups from a DSM node that works perfectly well on v2.2.2 but is not on v3-b2.
It's a customised version of the backup code found in the DSM examples wiki
Using the node.warn
messages, I can see that the init
code is being called, but when I trigger the node the status icon turns black and nothing happens.
Thanks
{
"currentState": "ready",
"states": {
"ready": {
"start": "step2",
"reset": "ready"
},
"step2": {
"tar": "step3",
"reset": "ready"
},
"step3": {
"output": "ready",
"reset": "ready"
}
},
"methods": {
"init": [
"node.warn('init');",
"sm.udir = RED.settings.userDir + '/';",
"sm.exec = require('child_process').exec;"
],
"start": [
"node.warn('start');",
"resume('tar', msg);"
],
"tar": [
"node.warn('tar');",
"sm.ts = new Date();",
"sm.days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];",
"sm.day = sm.days[sm.ts.getDay()];",
"sm.file = sm.udir + 'TESTING-NodeRED-' + sm.day + '.tar';",
"var pre = ' ' + sm.udir;",
"var cmd = 'tar -czvf';",
"cmd += ' ' + sm.file;",
"cmd += pre + 'flows*.json';",
"cmd += pre + '.config*.json';",
"cmd += pre + 'settings.js';",
"cmd += pre + 'package.json';",
"cmd += pre + 'package-lock.json';",
"cmd += pre + 'lib/*';",
"sm.fill = 'yellow';",
"sm.text = 'Compressing...';",
"output = false;",
"sm.exec(cmd, function(error, stdout, stderr) {",
" if (error) {",
" node.error(error);",
" } else {",
" resume('output', msg);",
" }",
"});"
],
"output": [
"node.warn('output');",
"sm.ts = new Date();",
"sm.days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];",
"sm.day = sm.days[sm.ts.getDay()];",
"sm.file = sm.udir + 'TESTING-NodeRED-' + sm.day + '.tar';",
"msg.topic = 'Node-RED';",
"msg.payload = sm.day + ' Backup Complete';",
"msg.filename = sm.file;",
"sm.fill = 'green';",
"sm.text = sm.day;"
],
"reset": [
"node.warn('reset');",
"sm.fill = 'grey';",
"sm.text = 'Reset';",
"output = false;"
],
"status": {
"fill": {
"get": "sm.fill"
},
"text": {
"get": "sm.text"
},
"shape": "dot"
}
}
}
EDIT, removed extra comma, thanks @cflurin. Still not working tho.