On Wed, Nov 6, 2019 at 12:26 PM onitsuka.shinic@fujitsu.com onitsuka.shinic@fujitsu.com wrote:
This patch executes the binary and script files in /etc/kdump/{pre.d,post.d} just like kdump_pre or kdump_post directive written in /etc/kdump.conf.
Signed-off-by: shin-onitsuka <onitsuka.shinic@fujitsu.com>
dracut-kdump.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 2ae1c7c..51a1f73 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -30,15 +30,51 @@ do_dump()
do_kdump_pre() {
- local _ret
- if [ -n "$KDUMP_PRE" ]; then "$KDUMP_PRE"
_ret=$?
if [ $_ret -ne 0 ]; then
echo "kdump: $KDUMP_PRE exited with $_ret status"
return $_ret
fi
- fi
- if [ -d /etc/kdump/pre.d ]; then
for file in `find /etc/kdump/pre.d -type f | sort`; do
"$file"
_ret=$?
if [ $_ret -ne 0 ]; then
echo "kdump: $file exited with $_ret status"
return $_ret
fi
fidone
}
Currently the behavior is: # kdump_pre <binary | script> # - Works like the "kdump_post" directive, but instead of running # after the dump process, runs immediately before it. # Exit status of this binary is interpreted as follows: # 0 - continue with dump process as usual # non 0 - reboot the system
After this patch, if any one of the scripts in pre.d failed, rest of the scripts will be skipped, and kdump will reboot the system. Better to doc this somewhere.
And this whole new thing needs a proper doc too.
do_kdump_post() {
- local _ret
- if [ -d /etc/kdump/post.d ]; then
for file in `find /etc/kdump/post.d -type f | sort`; do
"$file" "$1"
_ret=$?
if [ $_ret -ne 0 ]; then
echo "kdump: $file exited with $_ret status"
return $_ret
fi
done
- fi
- if [ -n "$KDUMP_POST" ]; then "$KDUMP_POST" "$1"
_ret=$?
if [ $_ret -ne 0 ]; then
echo "kdump: $KDUMP_POST exited with $_ret status"
return $_ret
fifi
}
-- 1.8.3.1
-- Best Regards, Kairui Song
-----Original Message----- From: Kairui Song [mailto:kasong@redhat.com] Sent: Tuesday, November 12, 2019 6:05 PM To: Onitsuka, Shinichi/鬼束 伸一 onitsuka.shinic@fujitsu.com Cc: kexec@lists.fedoraproject.org Subject: Re: [PATCH 1/3] dracut-kdump.sh: Execute the binary and script files in /etc/kdump/{pre.d,post.d}.
On Wed, Nov 6, 2019 at 12:26 PM onitsuka.shinic@fujitsu.com onitsuka.shinic@fujitsu.com wrote:
This patch executes the binary and script files in /etc/kdump/{pre.d,post.d} just like kdump_pre or kdump_post directive written in /etc/kdump.conf.
Signed-off-by: shin-onitsuka <onitsuka.shinic@fujitsu.com>
dracut-kdump.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 2ae1c7c..51a1f73 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -30,15 +30,51 @@ do_dump()
do_kdump_pre() {
- local _ret
- if [ -n "$KDUMP_PRE" ]; then "$KDUMP_PRE"
_ret=$?
if [ $_ret -ne 0 ]; then
echo "kdump: $KDUMP_PRE exited with $_ret status"
return $_ret
fi
- fi
- if [ -d /etc/kdump/pre.d ]; then
for file in `find /etc/kdump/pre.d -type f | sort`; do
"$file"
_ret=$?
if [ $_ret -ne 0 ]; then
echo "kdump: $file exited with $_ret status"
return $_ret
fi
fidone
}
Currently the behavior is: # kdump_pre <binary | script> # - Works like the "kdump_post" directive, but instead of running # after the dump process, runs immediately before it. # Exit status of this binary is interpreted as follows: # 0 - continue with dump process as usual # non 0 - reboot the system
After this patch, if any one of the scripts in pre.d failed, rest of the scripts will be skipped, and kdump will reboot the system. Better to doc this somewhere.
And this whole new thing needs a proper doc too.
In addition to the Kairui's comment, please mention explicitly in the doc the order of execution of kdump_pre and files in /etc/kdump/pre.d, i.e. the command specified in kdump_pre is first executed and then the rest of the commands under /etc/kdump/pre.d directory are executed.
do_kdump_post() {
- local _ret
- if [ -d /etc/kdump/post.d ]; then
for file in `find /etc/kdump/post.d -type f | sort`; do
"$file" "$1"
_ret=$?
if [ $_ret -ne 0 ]; then
echo "kdump: $file exited with $_ret status"
return $_ret
fi
done
- fi
- if [ -n "$KDUMP_POST" ]; then "$KDUMP_POST" "$1"
_ret=$?
if [ $_ret -ne 0 ]; then
echo "kdump: $KDUMP_POST exited with $_ret status"
return $_ret
fifi
}
-- 1.8.3.1
-- Best Regards, Kairui Song _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.or g