-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkill_ap.sh
More file actions
29 lines (23 loc) · 786 Bytes
/
kill_ap.sh
File metadata and controls
29 lines (23 loc) · 786 Bytes
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
#!/bin/bash
# Stop the create_ap process
echo "Stopping Access Point..."
sudo pkill create_ap
# Bring down the 'ap0' interface if it exists
if ip link show | grep -q "ap0"; then
echo "Bringing down 'ap0' interface..."
sudo ip link set ap0 down
fi
# Restore netplan configuration
BACKUP_NETPLAN_FILE="/etc/netplan/01-netcfg.yaml.bak"
CURRENT_NETPLAN_FILE="/etc/netplan/01-netcfg.yaml"
if [ -f "$BACKUP_NETPLAN_FILE" ]; then
echo "Restoring original netplan configuration..."
sudo cp "$BACKUP_NETPLAN_FILE" "$CURRENT_NETPLAN_FILE"
else
echo "Backup netplan configuration not found. Cannot restore."
exit 1
fi
# Apply netplan
echo "Applying restored netplan configuration..."
sudo netplan apply
echo "Access Point stopped and network configuration restored."