hola-server 0.8.9 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/bash.js +3 -7
- package/db/entity.js +1 -1
- package/package.json +1 -1
- package/setting.js +1 -1
package/core/bash.js
CHANGED
|
@@ -65,22 +65,18 @@ const run_script_extra = async (host, script, log_extra) => {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
const run_script_file = async (host, script_file, log_extra) => {
|
|
68
|
-
const log_file = await get_log_file();
|
|
69
|
-
|
|
70
68
|
return new Promise((resolve) => {
|
|
71
|
-
exec(`ssh ${host.auth} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p ${host.port} ${host.user}@${host.ip} /bin/bash < ${script_file}
|
|
69
|
+
exec(`ssh ${host.auth} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p ${host.port} ${host.user}@${host.ip} /bin/bash < ${script_file}`, (error, stdout) => {
|
|
72
70
|
if (error) {
|
|
73
71
|
if (is_log_error()) {
|
|
74
72
|
log_error(LOG_BASH, "error running on host:" + host.name + " the script_file:" + script_file + ",error:" + error, log_extra);
|
|
75
73
|
}
|
|
76
74
|
resolve({ stdout: stdout, err: "error running the script:" + script_file + ",error:" + error });
|
|
77
75
|
} else {
|
|
78
|
-
const output = fs.readFileSync(log_file, { encoding: 'utf8', flag: 'r' });
|
|
79
76
|
if (is_log_debug()) {
|
|
80
|
-
log_debug(LOG_BASH, "executing on host:" + host.name + ", script_file:" + script_file + ",stdout:" +
|
|
77
|
+
log_debug(LOG_BASH, "executing on host:" + host.name + ", script_file:" + script_file + ",stdout:" + stdout, log_extra);
|
|
81
78
|
}
|
|
82
|
-
resolve({ stdout:
|
|
83
|
-
fs.unlinkSync(log_file);
|
|
79
|
+
resolve({ stdout: stdout });
|
|
84
80
|
}
|
|
85
81
|
});
|
|
86
82
|
});
|
package/db/entity.js
CHANGED
package/package.json
CHANGED