aumentar proces on resources
This commit is contained in:
parent
a717969926
commit
6ad5c29035
|
@ -452,12 +452,30 @@ class DovecotMaildirDisk(ServiceMonitor):
|
|||
self.append(textwrap.dedent("""\
|
||||
function monitor () {
|
||||
SIZE=$(du -sb $1/Maildir/ 2> /dev/null || echo 0) && echo $SIZE | awk '{print $1}'
|
||||
list=()
|
||||
}"""))
|
||||
|
||||
def monitor(self, mailbox):
|
||||
context = self.get_context(mailbox)
|
||||
# self.append("echo %(object_id)s $(monitor %(maildir_path)s)" % context)
|
||||
self.append("echo %(object_id)s $(monitor %(home)s)" % context)
|
||||
# self.append("echo %(object_id)s $(monitor %(home)s)" % context)
|
||||
self.append("list[${#list[@]}]=\'echo %(object_id)s $(monitor %(home)s)\'" % context)
|
||||
|
||||
def commit(self):
|
||||
self.append(textwrap.dedent("""\
|
||||
proces=0
|
||||
for cmd in "${list[@]}"
|
||||
do
|
||||
eval $cmd &
|
||||
proces=$((proces+1))
|
||||
if [ $proces -ge 10 ];then
|
||||
wait
|
||||
proces=0
|
||||
fi
|
||||
done
|
||||
wait
|
||||
exit $exit_code
|
||||
"""))
|
||||
|
||||
def get_context(self, mailbox):
|
||||
context = {
|
||||
|
|
|
@ -287,13 +287,31 @@ class UNIXUserDisk(ServiceMonitor):
|
|||
self.append(textwrap.dedent("""\
|
||||
function monitor () {
|
||||
{ SIZE=$(du -bs "$1") && echo $SIZE || echo 0; } | awk {'print $1'}
|
||||
}"""
|
||||
))
|
||||
}
|
||||
list=()
|
||||
"""))
|
||||
|
||||
def monitor(self, user):
|
||||
context = self.get_context(user)
|
||||
self.append("echo %(object_id)s $(monitor %(base_home)s)" % context)
|
||||
# self.append("echo %(object_id)s $(monitor %(base_home)s)" % context)
|
||||
self.append("list[${#list[@]}]=\'echo %(object_id)s $(monitor %(base_home)s)\'" % context)
|
||||
|
||||
def commit(self):
|
||||
self.append(textwrap.dedent("""\
|
||||
proces=0
|
||||
for cmd in "${list[@]}"
|
||||
do
|
||||
eval $cmd &
|
||||
proces=$((proces+1))
|
||||
if [ $proces -ge 5 ];then
|
||||
wait
|
||||
proces=0
|
||||
fi
|
||||
done
|
||||
wait
|
||||
exit $exit_code
|
||||
"""))
|
||||
|
||||
def get_context(self, user):
|
||||
context = {
|
||||
'object_id': user.pk,
|
||||
|
|
Loading…
Reference in a new issue