implement remote shutdown
This commit is contained in:
13
manage.sh
13
manage.sh
@@ -42,7 +42,8 @@ connect_using_wpa_supp() {
|
|||||||
#}
|
#}
|
||||||
|
|
||||||
get_dhcp_ip () {
|
get_dhcp_ip () {
|
||||||
while true; do
|
while true;
|
||||||
|
do
|
||||||
sudo dhclient $DRONE_INTERFACE
|
sudo dhclient $DRONE_INTERFACE
|
||||||
ip_address=$(ip addr show wlan1 | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1)
|
ip_address=$(ip addr show wlan1 | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1)
|
||||||
if [[ -n $ip_address ]]; then
|
if [[ -n $ip_address ]]; then
|
||||||
@@ -76,6 +77,11 @@ kill_everything() {
|
|||||||
for p in $pids_dir/*.txt; do echo "killing $p"; sudo pkill $(cat "$p"); done
|
for p in $pids_dir/*.txt; do echo "killing $p"; sudo pkill $(cat "$p"); done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remote_shutdown() {
|
||||||
|
echo "shutting down drone commander rpi in 3 secs"
|
||||||
|
sleep 3
|
||||||
|
ssh uad@10.8.0.9 "sudo shutdown now"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
######################
|
######################
|
||||||
@@ -144,8 +150,9 @@ elif [ "$1" == "stop-cs" ]; then
|
|||||||
echo "stopped code server"
|
echo "stopped code server"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$1" == "stop-all" ]; then
|
elif [ "$1" == "turn-off" ]; then
|
||||||
kill_everything
|
kill_everything
|
||||||
|
remote_shutdown
|
||||||
|
|
||||||
######################
|
######################
|
||||||
## DRONE
|
## DRONE
|
||||||
@@ -193,6 +200,6 @@ else
|
|||||||
- start-/ stop-cs
|
- start-/ stop-cs
|
||||||
- start-/ stop-commander [port]
|
- start-/ stop-commander [port]
|
||||||
- start-talking
|
- start-talking
|
||||||
- stop-all
|
- turn-off
|
||||||
- prepare-/ finish-flight"
|
- prepare-/ finish-flight"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user