Skip to content
Open
Show file tree
Hide file tree
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
20 changes: 20 additions & 0 deletions scripts/coldreboot
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
REBOOT_CAUSE_FILE="/host/reboot-cause/reboot-cause.txt"
REBOOT_SCRIPT_NAME=$(basename $0)
REBOOT_USER=$(logname)
REBOOT_TIME=$(date)

# Exit if not superuser
if [[ "$EUID" -ne 0 ]]; then
echo "This command must be run as root" >&2
exit 1
fi

echo "User issued '${REBOOT_SCRIPT_NAME}' command [User: ${REBOOT_USER}, Time: ${REBOOT_TIME}]"> ${REBOOT_CAUSE_FILE}

# Wait until all buffers synced with disk
sync
sleep 1
sync

exec /sbin/coldreboot $*
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
'scripts/asic_config_check',
'scripts/boot_part',
'scripts/buffershow',
'scripts/coldreboot',
'scripts/coredump-compress',
'scripts/configlet',
'scripts/db_migrator.py',
Expand Down