blob: 5cbf49bb5b32ab8c4fe94b9f45276b1e34bea54e [file] [log] [blame]
Brandon Kimf2714342020-08-12 19:15:12 -07001#!/bin/bash
2#
3# PSU hard reset (power cycle) script.
4#
5# Power cycle the entire tray by setting the PSU hotswap reset (GPIO218) to high
6#
7# Global variable: PSU_HARDRESET_DELAY specifies the number of seconds to wait
8# before pulling the trigger. If not specified or zero, the script power cycles
9# immediately.
10main() {
11 # Sleep PSU_HARDRESET_DELAY seconds
12 local psu_delay=$((PSU_HARDRESET_DELAY))
13 if ((psu_delay > 0)); then
14 echo "Sleeping ${psu_delay} seconds before PSU hard reset!"
15 sleep "${psu_delay}"
16 fi
17
18 gpioset gpiochip6 26=1
19}
20
21# Exit without running main() if sourced
22return 0 2>/dev/null
23
24main "$@"