Skip to content
Merged
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
19 changes: 19 additions & 0 deletions device/arista/x86_64-arista_common/platform_update_reboot_cause
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python3

import os
from datetime import datetime, timezone

REBOOT_CAUSE_DIR = "/host/reboot-cause/"
REBOOT_LC_BY_SUPERVISOR_FILE = os.path.join(REBOOT_CAUSE_DIR, "reboot-lc-by-supervisor.txt")

def main():
reboot_time = datetime.now(timezone.utc).strftime("%a %b %d %I:%M:%S %p %Z %Y")

if os.path.exists(REBOOT_LC_BY_SUPERVISOR_FILE):
os.remove(REBOOT_LC_BY_SUPERVISOR_FILE)
with open(os.path.join(REBOOT_CAUSE_DIR, "reboot-cause.txt"), 'w') as reboot_cause_file:
reboot_msg = "User issued 'Reboot from Supervisor' command [User: Supervisor, Time: {}]".format(reboot_time)
reboot_cause_file.write(reboot_msg)

if __name__ == "__main__":
main()