Skip to content

Commit b445364

Browse files
[generate_dump] Ignoring file/directory not found Errors (sonic-net#1201)
Added checks to ignore files/directories that are not present while generating the dump. Signed-off-by: Sabareesh Kumar Anandan <[email protected]>
1 parent be834be commit b445364

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/generate_dump

+2-2
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ save_redis_info() {
326326
save_proc() {
327327
local procfiles="$@"
328328
$MKDIR $V -p $TARDIR/proc \
329-
&& $CP $V -r $procfiles $TARDIR/proc \
329+
&& (for f in $procfiles; do ( [ -e $f ] && $CP $V -r $f $TARDIR/proc ) || echo "$f not found" > $TARDIR/$f; done) \
330330
&& $TAR $V -rhf $TARFILE -C $DUMPDIR --mode=+rw $BASE/proc \
331331
&& $RM $V -rf $TARDIR/proc
332332
}
@@ -615,7 +615,7 @@ save_crash_files() {
615615
done
616616

617617
# archive kernel dump files
618-
for file in $(find_files "/var/crash/"); do
618+
[ -d /var/crash/ ] && for file in $(find_files "/var/crash/"); do
619619
# don't gzip already-gzipped dmesg files :)
620620
if [ ! ${file} = "/var/crash/kexec_cmd" -a ! ${file} = "/var/crash/export" ]; then
621621
if [[ ${file} == *"kdump."* ]]; then

0 commit comments

Comments
 (0)