-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathpower_supply_PowerUSB_Windows_cycle_power.sh
executable file
·51 lines (41 loc) · 1.39 KB
/
power_supply_PowerUSB_Windows_cycle_power.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# This file is part of eRCaGuy_dotfiles: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles
# GS
# Nov. 2023
# DESCRIPTION:
#
# Cycle power, in Windows, on a PowerUSB device from here:
# https://pwrusb.com/collections/all
#
# This Bash script is meant to be run on Windows in a Linux-like terminal such
# as Git Bash or MSYS2. For my MSYS2 setup instructions, see here:
# https://stackoverflow.com/a/77407282/4561887.
#
# See also: "power_supply_PowerUSB_Windows_cycle_power_README.md"
#
echo "Power cycling all 3 outlets."
PwrUsbCmd="/c/Program Files (x86)/PowerUSB/PwrUsbCmd.exe"
echo "Power OFF."
"$PwrUsbCmd" 0 0 0 # outlet1 outlet2 outlet3 OFF
echo "Waiting for 4 seconds with the power OFF..."
sleep 4
echo "Power ON."
"$PwrUsbCmd" 1 1 1 # outlet1 outlet2 outlet3 ON
echo "Done."
# Keep the terminal window open
echo "Press any key to continue..."
read -n 1
# EXAMPLE RUN OUTPUT:
#
# Power cycling all 3 outlets.
# Power OFF.
# PowerUSB Connected. Number of Devices:1 Model: 2. Version:3.3
# Before Setting Port Status: 1 1 1
# After Setting Port Status (unit1): 0 0 0
# Waiting for 4 seconds with the power OFF...
# Power ON.
# PowerUSB Connected. Number of Devices:1 Model: 2. Version:3.3
# Before Setting Port Status: 0 0 0
# After Setting Port Status (unit1): 1 1 1
# Done.
# Press any key to continue...