Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,9 @@ save_cmd() {
if $NOOP; then
echo "${timeout_cmd} $cmd $redirect '$filepath'"
else
eval "${timeout_cmd} $cmd" "$redirect" "$filepath"
if [ $? -ne 0 ]; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code looks good to me. Wondering where does it fail.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I see, it can fail when there's timeout.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't look deep into it. One possibility is that command timed out?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you were asking what the issue with this old structure. if line 198 returns non-zero code, then it would trigger the error handling and bypass the handling at 199.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it!

RC=0
eval "${timeout_cmd} $cmd" "$redirect" "$filepath" || RC=$?
if [ $RC -ne 0 ]; then
echo "Command: $cmd timedout after ${TIMEOUT_MIN} minutes."
fi
fi
Expand Down Expand Up @@ -988,26 +989,30 @@ save_warmboot_files() {
save_crash_files() {
# archive core dump files
trap 'handle_error $? $LINENO' ERR
for file in $(find_files "/var/core/"); do
# don't gzip already-gzipped log files :)
if [ -z "${file##*.gz}" ]; then
save_file $file core false
else
save_file $file core true
fi
done
if [ -d /var/core/ ]; then
for file in $(find_files "/var/core/"); do
# don't gzip already-gzipped log files :)
if [ -z "${file##*.gz}" ]; then
save_file $file core false
else
save_file $file core true
fi
done
fi

# archive kernel dump files
[ -d /var/crash/ ] && for file in $(find_files "/var/crash/"); do
# don't gzip already-gzipped dmesg files :)
if [ ! ${file} = "/var/crash/kexec_cmd" -a ! ${file} = "/var/crash/export" ]; then
if [[ ${file} == *"kdump."* ]]; then
save_file $file kdump false
else
save_file $file kdump true
if [ -d /var/crash/ ]; then
for file in $(find_files "/var/crash/"); do
# don't gzip already-gzipped dmesg files :)
if [ ! ${file} = "/var/crash/kexec_cmd" -a ! ${file} = "/var/crash/export" ]; then
if [[ ${file} == *"kdump."* ]]; then
save_file $file kdump false
else
save_file $file kdump true
fi
fi
fi
done
done
fi
}

###############################################################################
Expand Down