35 lines
1.2 KiB
Bash
Executable File
35 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
# Edited with Claude Code
|
|
# CGI: stop and disable wirecon-web. After this CGI returns, the web UI is
|
|
# unreachable. Re-enable from Console/SSH:
|
|
# rc-update add wirecon-web default && rc-service wirecon-web start
|
|
# POSIX-sh; busybox httpd may run CGI via ash regardless of shebang.
|
|
set -u
|
|
|
|
if [ "${REQUEST_METHOD:-}" != "POST" ]; then
|
|
printf 'Status: 405 Method Not Allowed\r\nContent-Type: text/plain\r\n\r\n'
|
|
echo "POST required"; exit 0
|
|
fi
|
|
|
|
printf 'Content-Type: text/plain\r\n\r\n'
|
|
echo "wirecon-web shutting down..."
|
|
echo ""
|
|
echo "to re-enable later (Console or SSH):"
|
|
echo " rc-update add wirecon-web default"
|
|
echo " rc-service wirecon-web start"
|
|
|
|
# Detach so the response gets flushed before httpd is killed. Brief sleep
|
|
# gives the kernel time to send our buffered body before rc-service stop
|
|
# tears the listening socket down.
|
|
(
|
|
ts() { date '+%Y-%m-%dT%H:%M:%S%z'; }
|
|
sleep 1
|
|
echo "[$(ts)] shutdown-web: rc-update del wirecon-web default"
|
|
rc-update del wirecon-web default 2>&1
|
|
echo "[$(ts)] shutdown-web: rc-service wirecon-web stop"
|
|
rc-service wirecon-web stop 2>&1
|
|
echo "[$(ts)] shutdown-web: done"
|
|
) </dev/null >>/var/log/wirecon-restart.log 2>&1 &
|
|
|
|
exit 0
|