[minor] report disk usage 0 if files path does not exist
This commit is contained in:
parent
fe5a9d66b3
commit
51f18b24ce
2 changed files with 7 additions and 2 deletions
|
|
@ -910,5 +910,9 @@ def get_site_name(hostname):
|
|||
|
||||
def get_disk_usage():
|
||||
"""get disk usage of files folder"""
|
||||
err, out = execute_in_shell("du -hsm {files_path}".format(files_path=get_files_path()))
|
||||
return cint(out.split("\n")[-2].split("\t")[0])
|
||||
import os
|
||||
files_path = get_files_path()
|
||||
if not os.path.exists(files_path):
|
||||
return 0
|
||||
err, out = execute_in_shell("du -hsm {files_path}".format(files_path=files_path))
|
||||
return cint(out.split("\n")[-2].split("\t")[0])
|
||||
|
|
|
|||
1
wnf.py
1
wnf.py
|
|
@ -348,6 +348,7 @@ def backup(site=None, with_files=False, verbose=True, backup_path_db=None, backu
|
|||
print "database backup taken -", odb.backup_path_db, "- on", now()
|
||||
if with_files:
|
||||
print "files backup taken -", odb.backup_path_files, "- on", now()
|
||||
webnotes.destroy()
|
||||
return odb
|
||||
|
||||
@cmd
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue