Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Commits
5cf33871
Commit
5cf33871
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
fix debian output on no reboot-required.pkgs
parent
edb41b4a
Branches
Branches containing commit
No related tags found
1 merge request
!41
fix debian output on no reboot-required.pkgs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_reboot_required
+64
-8
64 additions, 8 deletions
check_reboot_required
with
64 additions
and
8 deletions
check_reboot_required
+
64
−
8
View file @
5cf33871
...
...
@@ -5,27 +5,81 @@
#
# ----------------------------------------------------------------------
# works for sure on
# - centos7
# - debian6
,7
# - centos7
,8
# - debian6
..10
# - ubuntu10,12
# ----------------------------------------------------------------------
# 2016-08-12 added ouput of packages
# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# 2022-10-14 v1.3 <axel.hahn@unibe.ch> fix debian output if /var/run/reboot-required.pkgs does not exist
# Shellfixes; add help
# ======================================================================
.
`
dirname
$0
`
/inc_pluginfunctions
distro
=
`
ph.getOS
`
.
$(
dirname
$0
)
/inc_pluginfunctions
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPVERSION
=
1.3
distro
=
$(
ph.getOS
)
# ----------------------------------------------------------------------
# functions
# ----------------------------------------------------------------------
function
showHelp
(){
cat
<<
EOF
______________________________________________________________________
$self_APPNAME
v
$self_APPVERSION
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
______________________________________________________________________
Check if a reboot is required.
It works for Centos and Debian/ Ubuntu.
If the reboot is required:
* On Centos it shows the kernel number that will be installed,
* On Debian7 Ubuntu it shows the packages that require the reboot,
SYNTAX:
$(
basename
$0
)
OPTIONS:
-h or --help show this help.
PARAMETERS:
None.
EXAMPLE:
$(
basename
$0
)
EOF
}
# ----------------------------------------------------------------------
# --- check param -h
case
"
$1
"
in
"--help"
|
"-h"
)
showHelp
exit
0
;;
*
)
esac
case
$distro
in
"centos"
)
currentkernel
=
`
uname
-r
`
out
=
`
rpm
-q
--last
kernel |
head
-1
| fgrep
$currentkernel
`
currentkernel
=
$(
uname
-r
)
out
=
$(
rpm
-q
--last
kernel |
head
-1
| fgrep
$currentkernel
)
if
[
-z
"
$out
"
]
;
then
ph.setStatus
"warning"
ph.status
"[
$distro
] need to reboot for kernel
`
rpm
-q
--last
kernel |
head
-1
`
(current:
$currentkernel
)"
ph.status
"[
$distro
] need to reboot for kernel
$(
rpm
-q
--last
kernel |
head
-1
)
(current:
$currentkernel
)"
else
ph.status
"[
$distro
] no reboot required (kernel is up to date:
$currentkernel
)"
fi
...
...
@@ -36,8 +90,10 @@ case $distro in
if
[
!
-f
/var/run/reboot-required
]
;
then
ph.status
"[
$distro
] no reboot required"
else
byPackages
=
"(I do not know the package that requires it)"
test
-f
/var/run/reboot-required.pkgs
&&
byPackages
=
"by
$(
tr
'\n'
','
< /var/run/reboot-required.pkgs
)
"
ph.setStatus
"warning"
ph.status
"[
$distro
]
`
cat
/var/run/reboot-required
`
by
`
tr
'\n'
','
</var/run/reboot-required.pkgs
`
"
ph.status
"[
$distro
]
$(
cat
/var/run/reboot-required
)
${
byPackages
}
"
fi
;;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment