implement remote shutdown

This commit is contained in:
Alihan
2023-05-18 00:22:36 +03:00
parent 85eca41fba
commit 1db8e3b6e8

View File

@@ -42,7 +42,8 @@ connect_using_wpa_supp() {
#}
get_dhcp_ip () {
while true; do
while true;
do
sudo dhclient $DRONE_INTERFACE
ip_address=$(ip addr show wlan1 | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1)
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
}
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"
fi
elif [ "$1" == "stop-all" ]; then
elif [ "$1" == "turn-off" ]; then
kill_everything
remote_shutdown
######################
## DRONE
@@ -193,6 +200,6 @@ else
- start-/ stop-cs
- start-/ stop-commander [port]
- start-talking
- stop-all
- turn-off
- prepare-/ finish-flight"
fi