mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #1761 from YunoHost/small-tools
Add basic-space-cleanup command
This commit is contained in:
commit
54ad8dd2cb
2 changed files with 16 additions and 0 deletions
|
@ -1739,6 +1739,10 @@ tools:
|
||||||
help: python command to execute
|
help: python command to execute
|
||||||
full: --command
|
full: --command
|
||||||
|
|
||||||
|
### tools_basic_space_cleanup()
|
||||||
|
basic-space-cleanup:
|
||||||
|
action_help: Basic space cleanup (apt, journalctl, logs, ...)
|
||||||
|
|
||||||
### tools_shutdown()
|
### tools_shutdown()
|
||||||
shutdown:
|
shutdown:
|
||||||
action_help: Shutdown the server
|
action_help: Shutdown the server
|
||||||
|
|
12
src/tools.py
12
src/tools.py
|
@ -623,6 +623,18 @@ def tools_shell(command=None):
|
||||||
shell = code.InteractiveConsole(vars)
|
shell = code.InteractiveConsole(vars)
|
||||||
shell.interact()
|
shell.interact()
|
||||||
|
|
||||||
|
def tools_basic_space_cleanup():
|
||||||
|
"""
|
||||||
|
Basic space cleanup.
|
||||||
|
|
||||||
|
apt autoremove
|
||||||
|
apt autoclean
|
||||||
|
journalctl vacuum (leaves 50M of logs)
|
||||||
|
archived logs removal
|
||||||
|
"""
|
||||||
|
subprocess.run("apt autoremove && apt autoclean", shell=True)
|
||||||
|
subprocess.run("journalctl --vacuum-size=50M", shell=True)
|
||||||
|
subprocess.run("rm /var/log/*.gz && rm /var/log/*/*.gz && rm /var/log/*.? && rm /var/log/*/*.?", shell=True)
|
||||||
|
|
||||||
# ############################################ #
|
# ############################################ #
|
||||||
# #
|
# #
|
||||||
|
|
Loading…
Add table
Reference in a new issue