mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-01-13 07:01:20 +08:00
磁盘资源文件限制
This commit is contained in:
@@ -8,10 +8,12 @@ exports.joinPlan = (account, plan, callback) ->
|
||||
if serviceName in account.attribute.services
|
||||
return callback()
|
||||
|
||||
mAccount.update _id: account._id,
|
||||
mAccount.findAndModify _id: account._id, {},
|
||||
$addToSet:
|
||||
'attribute.services': serviceName
|
||||
, ->
|
||||
,
|
||||
new: true
|
||||
, (err, account)->
|
||||
(plugin.get serviceName).service.enable account, ->
|
||||
callback()
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ $ ->
|
||||
if $(@).attr('href') == location.pathname
|
||||
$(@).parent().addClass('active')
|
||||
|
||||
$('#logout').click ->
|
||||
$('#logout').click (e) ->
|
||||
e.preventDefault()
|
||||
$.post '/account/logout/', {}
|
||||
.success ->
|
||||
location.reload()
|
||||
|
||||
@@ -9,7 +9,19 @@ module.exports =
|
||||
enable: (account, callback) ->
|
||||
child_process.exec "sudo useradd -m -s /bin/bash #{account.username}", (err, stdout, stderr) ->
|
||||
throw err if err
|
||||
child_process.exec "sudo usermod -G #{account.username} -a www-data", (err, stdout, stderr) ->
|
||||
async.parallel [
|
||||
(callback) ->
|
||||
child_process.exec "sudo usermod -G #{account.username} -a www-data", callback
|
||||
|
||||
(callback) ->
|
||||
soft_limit = (account.attribute.resources_limit.storage * 1024 * 0.8).toFixed()
|
||||
hard_limit = (account.attribute.resources_limit.storage * 1024 * 1.2).toFixed()
|
||||
soft_inode_limit = (account.attribute.resources_limit.storage * 64 * 0.8).toFixed()
|
||||
hard_inode_limit = (account.attribute.resources_limit.storage * 64 * 1.2).toFixed()
|
||||
child_process.exec "sudo setquota -u #{account.username} #{soft_limit} #{hard_limit} #{soft_inode_limit} #{hard_inode_limit} -a", callback
|
||||
|
||||
], (err) ->
|
||||
throw err if err
|
||||
callback()
|
||||
|
||||
delete: (account, callback) ->
|
||||
|
||||
Reference in New Issue
Block a user