-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsolify.sh
More file actions
29 lines (23 loc) · 735 Bytes
/
consolify.sh
File metadata and controls
29 lines (23 loc) · 735 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
# Load configuration
SCRIPT_DIR="$(dirname "$0")"
CONFIG_FILE="$SCRIPT_DIR/config.env"
if [[ ! -f "$CONFIG_FILE" ]]; then
echo "Error: config.env not found! Run setup_wol.sh first."
exit 1
fi
# Read variables from config
source "$CONFIG_FILE"
LOG_FILE="$SCRIPT_DIR/logs/consolify.log"
mkdir -p "$(dirname "$LOG_FILE")"
echo "Starting WOL listener..." >> "$LOG_FILE"
while true; do
for MAC in "${CONTROLLER_MACS[@]}"; do
if hcitool scan | grep -q "$MAC"; then
echo "$(date): Controller $MAC detected! Sending Wake-on-LAN..." >> "$LOG_FILE"
wakeonlan "$PC_MAC"
sleep 10 # Prevent multiple WOL packets
fi
done
sleep 5 # Scan every 5 seconds
done