From a8adbf4cfd9882d87691f831c2e4b904a3fac49e Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 28 Apr 2017 10:12:50 +0800 Subject: [PATCH] modify fixmysql code --- app.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app.js b/app.js index a88b079..0370a1d 100644 --- a/app.js +++ b/app.js @@ -60,17 +60,19 @@ app.get('/servcmd', (req, res) => { }); app.get('/fixmysql', (req, res) => { - let cmd = 'rm /home/www/mydb/aria*'; - let json = { - rm: '', - restart: '' - }; - exec(cmd, (err, stdout, stderr) => { - let cmd = 'systemctl restart mysql'; - json.rm = stdout; - exec(cmd, (err, sout, serr) => { - json.restart = sout; - res.send(json); + exec('systemctl stop mysqld', (err, sout, serr) => { + let cmd = 'rm /home/www/mydb/aria*'; + let json = { + rm: '', + restart: '' + }; + exec(cmd, (err, stdout, stderr) => { + let cmd = 'systemctl restart mysqld'; + json.rm = stdout; + exec(cmd, (err, sout, serr) => { + json.restart = sout; + res.send(json); + }) }) }) }); \ No newline at end of file