This commit is contained in:
jysperm
2014-07-17 22:30:57 +08:00
parent 59d5e652f4
commit c0313ffd8b
2 changed files with 16 additions and 0 deletions

View File

@@ -14,3 +14,13 @@ Exception:
* invalid_password
* not_in_service
### POST /plugin/ssh/kill
Request:
{
"pid": 1234
}
No Response.

View File

@@ -22,3 +22,9 @@ exports.post '/update_password', (req, res) ->
child_process.exec "echo '#{req.account.username}:#{req.body.password}' | sudo chpassword", (err, stdout, stderr) ->
throw err if err
res.json {}
exports.post '/kill', (req, res) ->
pid = parseInt req.body.pid
child_process.exec "sudo su #{req.account.username} -c 'kill #{pid}}'", (err, stdout, stderr) ->
throw err if err
res.json {}