hackbox-hostapd/setup-systemd-rpi-hostapd

35 lines
1.0 KiB
Plaintext
Executable File

# move scripts into place (if not already)
sudo mv ~/setup-rpi-hotspot /usr/local/bin/setup-rpi-hotspot
sudo mv ~/patch-hostapd /usr/local/bin/patch-hostapd
# make sure they are executable and do not contain sudo (systemd runs as root)
sudo chmod +x /usr/local/bin/setup-rpi-hotspot /usr/local/bin/patch-hostapd
# write the unit file
sudo tee /etc/systemd/system/hotspot-chained.service > /dev/null <<'EOF'
[Unit]
Description=Raspberry Pi Hotspot Setup (setup-rpi-hotspot → patch-hostapd)
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
StandardOutput=journal
StandardError=journal
RemainAfterExit=yes
TimeoutStartSec=120
ExecStart=/bin/bash -lc '/usr/local/bin/setup-rpi-hotspot && sleep 2 && /usr/local/bin/patch-hostapd'
[Install]
WantedBy=multi-user.target
EOF
# reload systemd and enable/start
sudo systemctl daemon-reload
sudo systemctl enable --now hotspot-chained.service
# check status/logs
sudo systemctl status hotspot-chained.service --no-pager
sudo journalctl -u hotspot-chained.service -n 200 --no-pager