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.
|
||||
# The exit status of the current dump process is fed to
|
||||
# the executable binary or script as its first argument.
|
||||
# If /etc/kdump/post.d directory exists, all files in
|
||||
# the directory are collectively sorted and executed in
|
||||
# lexical order, before binary or script specified
|
||||
# kdump_post parameter is executed.
|
||||
# All files under /etc/kdump/post.d are collectively sorted
|
||||
# and executed in lexical order, before binary or script
|
||||
# specified kdump_post parameter is executed.
|
||||
#
|
||||
# kdump_pre <binary | script>
|
||||
# - Works like the "kdump_post" directive, but instead of running
|
||||
@ -90,9 +89,8 @@
|
||||
# Exit status of this binary is interpreted as follows:
|
||||
# 0 - continue with dump process as usual
|
||||
# non 0 - run the final action (reboot/poweroff/halt)
|
||||
# If /etc/kdump/pre.d directory exists, all files in
|
||||
# the directory are collectively sorted and executed in
|
||||
# lexical order, after binary or script specified
|
||||
# All files under /etc/kdump/pre.d are collectively sorted and
|
||||
# executed in lexical order, after binary or script specified
|
||||
# kdump_pre parameter is executed.
|
||||
# Even if the binary or script in /etc/kdump/pre.d directory
|
||||
# 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
|
||||
it to indicate the new exit status of succeeding dump process,
|
||||
.PP
|
||||
If /etc/kdump/post.d directory exists, All files in
|
||||
the directory are collectively sorted and executed in
|
||||
lexical order, before binary or script specified
|
||||
kdump_post parameter is executed.
|
||||
All files under /etc/kdump/post.d are collectively sorted
|
||||
and executed in lexical order, before binary or script
|
||||
specified kdump_post parameter is executed.
|
||||
.PP
|
||||
Note that scripts written for use with this directive must use
|
||||
the /bin/bash interpreter.
|
||||
@ -129,9 +128,8 @@ as follows:
|
||||
.PP
|
||||
non 0 - run the final action (reboot/poweroff/halt)
|
||||
.PP
|
||||
If /etc/kdump/pre.d directory exists, all files in
|
||||
the directory are collectively sorted and executed in
|
||||
lexical order, after binary or script specified
|
||||
All files under /etc/kdump/pre.d are collectively sorted and
|
||||
executed in lexical order, after binary or script specified
|
||||
kdump_pre parameter is executed.
|
||||
Even if the binary or script in /etc/kdump/pre.d directory
|
||||
returns non 0 exit status, the processing is continued.
|
||||
|
6
kdumpctl
6
kdumpctl
@ -151,7 +151,7 @@ rebuild_initrd()
|
||||
check_exist()
|
||||
{
|
||||
for file in $1; do
|
||||
if [ ! -f "$file" ]; then
|
||||
if [ ! -e "$file" ]; then
|
||||
echo -n "Error: $file not found."; echo
|
||||
return 1
|
||||
fi
|
||||
@ -385,11 +385,11 @@ check_files_modified()
|
||||
done
|
||||
fi
|
||||
|
||||
# HOOKS is mandatory and need to check the modification time
|
||||
files="$files $HOOKS"
|
||||
check_exist "$files" && check_executable "$EXTRA_BINS"
|
||||
[ $? -ne 0 ] && return 2
|
||||
|
||||
# HOOKS only need to check the modification here
|
||||
files="$files $HOOKS"
|
||||
for file in $files; do
|
||||
if [ -e "$file" ]; then
|
||||
time_stamp=`stat -c "%Y" $file`
|
||||
|
Loading…
Reference in New Issue
Block a user