Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event mgmt #1695

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
17 changes: 17 additions & 0 deletions scripts/reboot
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,21 @@ function clear_warm_boot()
/sbin/kexec -u || /bin/true
}

function backup_database()
{
COLD_DIR=/host/coldboot
REDIS_FILE=dump.rdb
mkdir -p $COLD_DIR

# Dump redis EventDB content to file in case 'dump.rdb' in case of coldreboot
sonic-db-cli EVENT_DB save

docker cp database:/var/lib/redis1/$REDIS_FILE $COLD_DIR

# Cleanup all dump.rdb files, if any
docker exec -i database find /var/lib/ | grep $REDIS_FILE | xargs docker exec -i database rm
}

SCRIPT=$0

function show_help_and_exit()
Expand Down Expand Up @@ -173,6 +188,8 @@ stop_sonic_services

clear_warm_boot

backup_database

# Update the reboot cause file to reflect that user issued 'reboot' command
# Upon next boot, the contents of this file will be used to determine the
# cause of the previous reboot
Expand Down