Skip to content

Commit

Permalink
journald: Fix action comment and use --vacuum-size=0
Browse files Browse the repository at this point in the history
`--vacuum-*` commands only remove archived log files, so need to
investigate how to forcefullty archive them.

Also need to sum up sizes from all files removed instead of using
only the last one.
  • Loading branch information
abitrolly committed Apr 25, 2023
1 parent 203da0e commit d88ba5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bleachbit/Action.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,15 +466,15 @@ def get_commands(self):


class Journald(ActionProvider):
"""Action to run 'journalctl --vacuum-time=1'"""
"""Action to run 'journalctl --vacuum-size=0'"""
action_key = 'journald.clean'

def __init__(self, action_element, path_vars=None):
ActionProvider.__init__(self, action_element, path_vars)

def get_commands(self):
if FileUtilities.exe_exists('journalctl'):
yield Command.Function(None, Unix.journald_clean, 'journalctl --vacuum-time=1')
yield Command.Function(None, Unix.journald_clean, 'journalctl --vacuum-size=0')


class Json(FileActionProvider):
Expand Down
2 changes: 1 addition & 1 deletion bleachbit/Unix.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def run_cleaner_cmd(cmd, args, freed_space_regex=r'[\d.]+[kMGTE]?B?', error_line
def journald_clean():
"""Clean the system journals"""
try:
return run_cleaner_cmd('journalctl', ['--vacuum-size=1'], JOURNALD_REGEX)
return run_cleaner_cmd('journalctl', ['--vacuum-size=0'], JOURNALD_REGEX)
except subprocess.CalledProcessError as e:
raise RuntimeError("Error calling '%s':\n%s" %
(' '.join(e.cmd), e.output))
Expand Down

0 comments on commit d88ba5c

Please sign in to comment.