kdumpctl: exit if either pre.d or post.d is missing
It is hard to detect the time that /etc/kdump is removed. And this failure may cause out-of-date kdump.initrd. To keep things simple, just exit if /etc/kdump/pre.d and post.d does not exist. Signed-off-by: Pingfan Liu <piliu@redhat.com> Acked-by: Kairui Song <kasong@redhat.com>
This commit is contained in:
parent
1844d088f7
commit
f96172d353
12
kdump.conf
12
kdump.conf
@ -79,10 +79,9 @@
|
|||||||
# or script after the vmcore dump process terminates.
|
# or script after the vmcore dump process terminates.
|
||||||
# The exit status of the current dump process is fed to
|
# The exit status of the current dump process is fed to
|
||||||
# the executable binary or script as its first argument.
|
# the executable binary or script as its first argument.
|
||||||
# If /etc/kdump/post.d directory exists, all files in
|
# All files under /etc/kdump/post.d are collectively sorted
|
||||||
# the directory are collectively sorted and executed in
|
# and executed in lexical order, before binary or script
|
||||||
# lexical order, before binary or script specified
|
# specified kdump_post parameter is executed.
|
||||||
# kdump_post parameter is executed.
|
|
||||||
#
|
#
|
||||||
# kdump_pre <binary | script>
|
# kdump_pre <binary | script>
|
||||||
# - Works like the "kdump_post" directive, but instead of running
|
# - Works like the "kdump_post" directive, but instead of running
|
||||||
@ -90,9 +89,8 @@
|
|||||||
# Exit status of this binary is interpreted as follows:
|
# Exit status of this binary is interpreted as follows:
|
||||||
# 0 - continue with dump process as usual
|
# 0 - continue with dump process as usual
|
||||||
# non 0 - run the final action (reboot/poweroff/halt)
|
# non 0 - run the final action (reboot/poweroff/halt)
|
||||||
# If /etc/kdump/pre.d directory exists, all files in
|
# All files under /etc/kdump/pre.d are collectively sorted and
|
||||||
# the directory are collectively sorted and executed in
|
# executed in lexical order, after binary or script specified
|
||||||
# lexical order, after binary or script specified
|
|
||||||
# kdump_pre parameter is executed.
|
# kdump_pre parameter is executed.
|
||||||
# Even if the binary or script in /etc/kdump/pre.d directory
|
# Even if the binary or script in /etc/kdump/pre.d directory
|
||||||
# returns non 0 exit status, the processing is continued.
|
# returns non 0 exit status, the processing is continued.
|
||||||
|
12
kdump.conf.5
12
kdump.conf.5
@ -109,10 +109,9 @@ status of the current dump process is fed to the kdump_post
|
|||||||
executable as its first argument($1). Executable can modify
|
executable as its first argument($1). Executable can modify
|
||||||
it to indicate the new exit status of succeeding dump process,
|
it to indicate the new exit status of succeeding dump process,
|
||||||
.PP
|
.PP
|
||||||
If /etc/kdump/post.d directory exists, All files in
|
All files under /etc/kdump/post.d are collectively sorted
|
||||||
the directory are collectively sorted and executed in
|
and executed in lexical order, before binary or script
|
||||||
lexical order, before binary or script specified
|
specified kdump_post parameter is executed.
|
||||||
kdump_post parameter is executed.
|
|
||||||
.PP
|
.PP
|
||||||
Note that scripts written for use with this directive must use
|
Note that scripts written for use with this directive must use
|
||||||
the /bin/bash interpreter.
|
the /bin/bash interpreter.
|
||||||
@ -129,9 +128,8 @@ as follows:
|
|||||||
.PP
|
.PP
|
||||||
non 0 - run the final action (reboot/poweroff/halt)
|
non 0 - run the final action (reboot/poweroff/halt)
|
||||||
.PP
|
.PP
|
||||||
If /etc/kdump/pre.d directory exists, all files in
|
All files under /etc/kdump/pre.d are collectively sorted and
|
||||||
the directory are collectively sorted and executed in
|
executed in lexical order, after binary or script specified
|
||||||
lexical order, after binary or script specified
|
|
||||||
kdump_pre parameter is executed.
|
kdump_pre parameter is executed.
|
||||||
Even if the binary or script in /etc/kdump/pre.d directory
|
Even if the binary or script in /etc/kdump/pre.d directory
|
||||||
returns non 0 exit status, the processing is continued.
|
returns non 0 exit status, the processing is continued.
|
||||||
|
6
kdumpctl
6
kdumpctl
@ -151,7 +151,7 @@ rebuild_initrd()
|
|||||||
check_exist()
|
check_exist()
|
||||||
{
|
{
|
||||||
for file in $1; do
|
for file in $1; do
|
||||||
if [ ! -f "$file" ]; then
|
if [ ! -e "$file" ]; then
|
||||||
echo -n "Error: $file not found."; echo
|
echo -n "Error: $file not found."; echo
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -385,11 +385,11 @@ check_files_modified()
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# HOOKS is mandatory and need to check the modification time
|
||||||
|
files="$files $HOOKS"
|
||||||
check_exist "$files" && check_executable "$EXTRA_BINS"
|
check_exist "$files" && check_executable "$EXTRA_BINS"
|
||||||
[ $? -ne 0 ] && return 2
|
[ $? -ne 0 ] && return 2
|
||||||
|
|
||||||
# HOOKS only need to check the modification here
|
|
||||||
files="$files $HOOKS"
|
|
||||||
for file in $files; do
|
for file in $files; do
|
||||||
if [ -e "$file" ]; then
|
if [ -e "$file" ]; then
|
||||||
time_stamp=`stat -c "%Y" $file`
|
time_stamp=`stat -c "%Y" $file`
|
||||||
|
Loading…
Reference in New Issue
Block a user