diff --git a/device/arista/x86_64-arista_7800r3_48cq2_lc/platform_update_reboot_cause b/device/arista/x86_64-arista_7800r3_48cq2_lc/platform_update_reboot_cause new file mode 120000 index 0000000000..31acab4f44 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cq2_lc/platform_update_reboot_cause @@ -0,0 +1 @@ +./../x86_64-arista_common/platform_update_reboot_cause \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform_update_reboot_cause b/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform_update_reboot_cause new file mode 120000 index 0000000000..31acab4f44 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform_update_reboot_cause @@ -0,0 +1 @@ +./../x86_64-arista_common/platform_update_reboot_cause \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/platform_update_reboot_cause b/device/arista/x86_64-arista_7800r3a_36d2_lc/platform_update_reboot_cause new file mode 120000 index 0000000000..31acab4f44 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/platform_update_reboot_cause @@ -0,0 +1 @@ +./../x86_64-arista_common/platform_update_reboot_cause \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d_lc/platform_update_reboot_cause b/device/arista/x86_64-arista_7800r3a_36d_lc/platform_update_reboot_cause new file mode 120000 index 0000000000..31acab4f44 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d_lc/platform_update_reboot_cause @@ -0,0 +1 @@ +./../x86_64-arista_common/platform_update_reboot_cause \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36dm2_lc/platform_update_reboot_cause b/device/arista/x86_64-arista_7800r3a_36dm2_lc/platform_update_reboot_cause new file mode 120000 index 0000000000..31acab4f44 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36dm2_lc/platform_update_reboot_cause @@ -0,0 +1 @@ +./../x86_64-arista_common/platform_update_reboot_cause \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36p_lc/platform_update_reboot_cause b/device/arista/x86_64-arista_7800r3a_36p_lc/platform_update_reboot_cause new file mode 120000 index 0000000000..31acab4f44 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36p_lc/platform_update_reboot_cause @@ -0,0 +1 @@ +./../x86_64-arista_common/platform_update_reboot_cause \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3ak_36d2_lc/platform_update_reboot_cause b/device/arista/x86_64-arista_7800r3ak_36d2_lc/platform_update_reboot_cause new file mode 120000 index 0000000000..31acab4f44 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3ak_36d2_lc/platform_update_reboot_cause @@ -0,0 +1 @@ +./../x86_64-arista_common/platform_update_reboot_cause \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3ak_36dm2_lc/platform_update_reboot_cause b/device/arista/x86_64-arista_7800r3ak_36dm2_lc/platform_update_reboot_cause new file mode 120000 index 0000000000..31acab4f44 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3ak_36dm2_lc/platform_update_reboot_cause @@ -0,0 +1 @@ +./../x86_64-arista_common/platform_update_reboot_cause \ No newline at end of file diff --git a/device/arista/x86_64-arista_common/platform_update_reboot_cause b/device/arista/x86_64-arista_common/platform_update_reboot_cause new file mode 100755 index 0000000000..fe76e34ef9 --- /dev/null +++ b/device/arista/x86_64-arista_common/platform_update_reboot_cause @@ -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()