aumentar proces on resources
This commit is contained in:
parent
a717969926
commit
6ad5c29035
|
@ -452,12 +452,30 @@ class DovecotMaildirDisk(ServiceMonitor):
|
||||||
self.append(textwrap.dedent("""\
|
self.append(textwrap.dedent("""\
|
||||||
function monitor () {
|
function monitor () {
|
||||||
SIZE=$(du -sb $1/Maildir/ 2> /dev/null || echo 0) && echo $SIZE | awk '{print $1}'
|
SIZE=$(du -sb $1/Maildir/ 2> /dev/null || echo 0) && echo $SIZE | awk '{print $1}'
|
||||||
|
list=()
|
||||||
}"""))
|
}"""))
|
||||||
|
|
||||||
def monitor(self, mailbox):
|
def monitor(self, mailbox):
|
||||||
context = self.get_context(mailbox)
|
context = self.get_context(mailbox)
|
||||||
# self.append("echo %(object_id)s $(monitor %(maildir_path)s)" % context)
|
# 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):
|
def get_context(self, mailbox):
|
||||||
context = {
|
context = {
|
||||||
|
|
|
@ -287,13 +287,31 @@ class UNIXUserDisk(ServiceMonitor):
|
||||||
self.append(textwrap.dedent("""\
|
self.append(textwrap.dedent("""\
|
||||||
function monitor () {
|
function monitor () {
|
||||||
{ SIZE=$(du -bs "$1") && echo $SIZE || echo 0; } | awk {'print $1'}
|
{ SIZE=$(du -bs "$1") && echo $SIZE || echo 0; } | awk {'print $1'}
|
||||||
}"""
|
}
|
||||||
))
|
list=()
|
||||||
|
"""))
|
||||||
|
|
||||||
def monitor(self, user):
|
def monitor(self, user):
|
||||||
context = self.get_context(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):
|
def get_context(self, user):
|
||||||
context = {
|
context = {
|
||||||
'object_id': user.pk,
|
'object_id': user.pk,
|
||||||
|
|
Loading…
Reference in New Issue