Closed komish closed 6 years ago
@tonyskapunk
The issue is that the default config does not specify an action to take from what I see, so the service reports as failed because the command with no arguments/config returns a non-zero exit code
# systemctl status kthresher.service
● kthresher.service - Purge unused kernels
Loaded: loaded (/etc/systemd/system/kthresher.service; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2018-10-07 23:58:01 UTC; 25s ago
Docs: man:kthresher(8)
Process: 4759 ExecStart=/usr/local/bin/kthresher (code=exited, status=1/FAILURE)
Main PID: 4759 (code=exited, status=1/FAILURE)
Oct 07 23:58:01 ubuntu systemd[1]: kthresher.service: Main process exited, code=exited, status=1/FAILURE
Oct 07 23:58:01 ubuntu systemd[1]: kthresher.service: Failed with result 'exit-code'.
Oct 07 23:58:01 ubuntu systemd[1]: Failed to start Purge unused kernels.
# kthresher &>/dev/null; echo $?
1
If that's fine, I'll remove the --dry-run
. Alternatives might include leaving --dry-run
, or specifying the ExecStart
line have a -
before the executable here. This causes systemd to ignore the non-zero and report success (or in this case, inactivity). I'm not sure that's a better path - when we get non-zero, I would imagine we want this to report failure.
ExecStart=-/usr/local/bin/kthresher
# systemctl status kthresher.service
● kthresher.service - Purge unused kernels
Loaded: loaded (/etc/systemd/system/kthresher.service; static; vendor preset: enabled)
Active: inactive (dead) since Mon 2018-10-08 00:00:00 UTC; 8s ago
Docs: man:kthresher(8)
Process: 4874 ExecStart=/usr/local/bin/kthresher (code=exited, status=1/FAILURE)
Main PID: 4874 (code=exited, status=1/FAILURE)
Let me know which you would prefer.
The config I'm seeing as "default" for reference
[main]
include = /etc/kthresher.d/*.conf
# Is recommended to put the configuration in the included directory instead
# of making changes in here.
#
# The options are:
# headers - [ yes | on | true | no | off | false ] Include or not the headers.
# include - [ /path/to/file ] Suports globbing, e.g. /path/to/dir/*.conf
# keep - Number of kernel images to keep (0-9), default is 1 if none defined
# purge - [ yes | on | true | no | off | false ] Commit changes
# verbose - [ yes | on | true | no | off | false ] Be verbose
#
# NOTES:
# 1) The --dry-run option is only allowed through CLI, if purge is defined
# in the config file and --dru-run is used, the latter has precedence.
# 2) IF defined, only the non-boolean options can be overriden from CLI.```
There is nothing in the related `kthresher.d` out of the box.
For now let's remove the --dry-run
I'll make the changes to avoid a failure. Thanks @Komish
@tonyskapunk Done - I've removed the comment and the --dry-run
flag. Should be set to go. Let me know if there is anything further!
Thaaaanks!, there will be stickers! :+1:
Provides Systemd Timer and associated service file for optional use.
Fixes #48
Considerations
OnCalendar=daily
is being used to match the provided cron.daily file. This was tested usingOnCalendar=minutely
or equivalent (detailed below)..service
and.timer
files have been tested withsystemd-analyze
where possible. This may be worth including in tests at a later time - if the test suite of choice has the capability.OnCalendar=minutely
in this version, however daily is an option so*-*-* *:*:00
was used for testing to simulate the same behavior asminutely
.systemd-analyze
did not have averify
option in this version./usr/local/bin/kthresher
- I've left/usr/bin/kthresher
as the path to use to match the cron.daily example but testing was done at the specified path. Shouldn't impact anything, but we cannot dynamically build the path given the current installation procedure.