* usr/bin/purge-old-kernels, usr/share/man/man1/purge-old-kernels.1:

- add a --quiet option for cronjobs
  - add note in the manpage
This commit is contained in:
Dustin Kirkland 2017-03-18 12:04:47 -05:00
commit 59b5b264f0
3 changed files with 22 additions and 3 deletions

5
debian/changelog vendored
View file

@ -7,6 +7,11 @@ byobu (5.116) unreleased; urgency=medium
- save 100K lines of scrollback, rather than 10K, which I find gets
eclipsed too often when you actually need it
[ janvonde ]
* usr/bin/purge-old-kernels, usr/share/man/man1/purge-old-kernels.1:
- add a --quiet option for cronjobs
- add note in the manpage
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 06 Feb 2017 12:22:26 -0600
byobu (5.115-0ubuntu1) zesty; urgency=medium

View file

@ -28,10 +28,18 @@ fi
# NOTE: This script will ALWAYS keep the currently running kernel
# NOTE: Default is to keep 2 more, user overrides with --keep N
KEEP=2
# NOTE: This script will give a hint if no kernels are eligible for removal
# NOTE: You can disable this with the --quit parameter
QUIET=0
# NOTE: Any unrecognized option will be passed straight through to apt
APT_OPTS=
while [ ! -z "$1" ]; do
case "$1" in
--quiet)
# No hint on no kernels for removal, better for cronjobs
QUIET=1
shift 1
;;
--keep)
# User specified the number of kernels to keep
KEEP="$2"
@ -61,8 +69,12 @@ for v in $VERSIONS; do
done
if [ -z "$PURGE" ]; then
echo "No kernels are eligible for removal"
exit 0
if [ "${QUIET}" -ne "1" ]; then
echo "No kernels are eligible for removal"
exit 0
else
exit 0
fi
fi
# Use apt-get, rather than apt, for compatibility with precise/trusty

View file

@ -3,11 +3,13 @@
purge-old-kernels - remove old kernel and header packages from the system
.SH SYNOPSIS
\fBpurge-old-kernels\fP [--keep N] [*]
\fBpurge-old-kernels\fP [--keep N] [--quiet] [*]
.SH DESCRIPTION
This program will remove old kernel and header packages from the system, freeing disk space. It will never remove the currently running kernel. By default, it will keep at least the latest 2 kernels, but the user can override that value using the --keep parameter. Any additional parameters will be passed directly to \fBapt-get\fP(8).
The --quiet option is useful for cronjobs, to ensure silence messages when there's nothing new to do.
This program requires administrative access.
.SH EXAMPLE