fix memload()
This commit is contained in:
parent
e6eace7375
commit
0a177c1a5b
@ -20,7 +20,7 @@ def memload():
|
|||||||
for s in mem_list:
|
for s in mem_list:
|
||||||
mem_list_names.append(s.split(':')[0])
|
mem_list_names.append(s.split(':')[0])
|
||||||
if mem_list_names[2] != 'MemAvailable':
|
if mem_list_names[2] != 'MemAvailable':
|
||||||
errprint('WARNING: Your Linux kernel is too old, Linux 3.14+ requied')
|
errprint('Your Linux kernel is too old, Linux 3.14+ requied\nExit')
|
||||||
exit(1)
|
exit(1)
|
||||||
swap_total_index = mem_list_names.index('SwapTotal')
|
swap_total_index = mem_list_names.index('SwapTotal')
|
||||||
swap_free_index = swap_total_index + 1
|
swap_free_index = swap_total_index + 1
|
||||||
@ -49,7 +49,7 @@ def memload():
|
|||||||
luid_init = rline1('/proc/1/loginuid')
|
luid_init = rline1('/proc/1/loginuid')
|
||||||
luid_self = rline1('/proc/self/loginuid')
|
luid_self = rline1('/proc/self/loginuid')
|
||||||
if luid_init == luid_self:
|
if luid_init == luid_self:
|
||||||
print('Self login UID = init login UID, exit')
|
print('Self login UID = init login UID\nExit')
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -60,13 +60,12 @@ def memload():
|
|||||||
'nue? [No/Yes] '
|
'nue? [No/Yes] '
|
||||||
inp = input(hi)
|
inp = input(hi)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('KeyboardInterrupt, exit')
|
print('KeyboardInterrupt\nExit')
|
||||||
exit(1)
|
exit(1)
|
||||||
if inp != 'Yes':
|
if inp != 'Yes':
|
||||||
print('Exit')
|
print('Exit')
|
||||||
exit()
|
exit()
|
||||||
else:
|
else:
|
||||||
mem_available, swap_total, swap_free = check_mem_and_swap()
|
|
||||||
print('Memory consumption has started!\n')
|
print('Memory consumption has started!\n')
|
||||||
|
|
||||||
ex = []
|
ex = []
|
||||||
|
Loading…
Reference in New Issue
Block a user