mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-20 13:33:23 -07:00
adds --quiet option for non-verbose cronjob run
I run this script daily via a cronjob. It generates a daily mail with the information "No kernels are eligible for removal". This patch adds an optional --quiet parameter to hide this message.
This commit is contained in:
parent
e7f6e5d6e1
commit
678dd9ebcc
1 changed files with 14 additions and 2 deletions
|
@ -28,10 +28,18 @@ fi
|
||||||
# NOTE: This script will ALWAYS keep the currently running kernel
|
# NOTE: This script will ALWAYS keep the currently running kernel
|
||||||
# NOTE: Default is to keep 2 more, user overrides with --keep N
|
# NOTE: Default is to keep 2 more, user overrides with --keep N
|
||||||
KEEP=2
|
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
|
# NOTE: Any unrecognized option will be passed straight through to apt
|
||||||
APT_OPTS=
|
APT_OPTS=
|
||||||
while [ ! -z "$1" ]; do
|
while [ ! -z "$1" ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
--quiet)
|
||||||
|
# No hint on no kernels for removal, better for cronjobs
|
||||||
|
QUIET=1
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
--keep)
|
--keep)
|
||||||
# User specified the number of kernels to keep
|
# User specified the number of kernels to keep
|
||||||
KEEP="$2"
|
KEEP="$2"
|
||||||
|
@ -61,8 +69,12 @@ for v in $VERSIONS; do
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "$PURGE" ]; then
|
if [ -z "$PURGE" ]; then
|
||||||
|
if [ "${QUIET}" -ne "1" ]; then
|
||||||
echo "No kernels are eligible for removal"
|
echo "No kernels are eligible for removal"
|
||||||
exit 0
|
exit 0
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use apt-get, rather than apt, for compatibility with precise/trusty
|
# Use apt-get, rather than apt, for compatibility with precise/trusty
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue