rp_stop_uhubctl: Switch to SSH key auth for RP shutdown
This commit is contained in:
parent
698e90df1c
commit
001e981a65
|
@ -6,12 +6,21 @@ export HOST=rpi-3
|
||||||
export HOSTPORT=22
|
export HOSTPORT=22
|
||||||
# Hub port where the RedPitaya is connected
|
# Hub port where the RedPitaya is connected
|
||||||
export HUBPORT=4
|
export HUBPORT=4
|
||||||
# RedPitaya hostname and root information
|
# RedPitaya hostname and user information
|
||||||
|
# (The user should have privilege to run `shutdown` - check out `visudo`)
|
||||||
|
# (Add local SSH key to RP's authorized keys for passwordless login)
|
||||||
export RP_HOST=rp-f0612e
|
export RP_HOST=rp-f0612e
|
||||||
|
export RP_USER=tester
|
||||||
|
export RP_KEY=~/.ssh/rp
|
||||||
|
|
||||||
# Issue shutdown on the RedPitaya
|
# Issue shutdown on the RedPitaya
|
||||||
echo "Requesting shutdown on RP at $RP_HOST. Please enter password."
|
echo "Requesting shutdown on RP at $RP_HOST."
|
||||||
ssh -o PubkeyAuthentication=no -o PreferredAuthentications=password root@$RP_HOST "shutdown 0"
|
if [[ $RP_KEY == "" ]]
|
||||||
|
then
|
||||||
|
ssh $RP_USER@$RP_HOST "sudo shutdown 0"
|
||||||
|
else
|
||||||
|
ssh -i $RP_KEY $RP_USER@$RP_HOST "sudo shutdown 0"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if RedPitaya has been disconnected from network by pinging
|
# Check if RedPitaya has been disconnected from network by pinging
|
||||||
while ping $RP_HOST -c 1 >/dev/null 2>/dev/null
|
while ping $RP_HOST -c 1 >/dev/null 2>/dev/null
|
||||||
|
|
Loading…
Reference in New Issue