2 Commits

Author SHA1 Message Date
416d437aef Fix shutdown command by using full path to /sbin/shutdown
Updated shutdown and reboot commands to use absolute paths to ensure
they work correctly with the sudoers configuration. Also updated the
sudoers file to allow shutdown with specific arguments.

Changes:
- Use /sbin/shutdown instead of just shutdown
- Use /sbin/reboot instead of just reboot
- Updated sudoers to allow both 'shutdown -h +1' and 'shutdown -h now'
- Ensures commands match sudoers whitelist exactly

The restart was working because reboot might be in PATH, but shutdown
needs the full path to match the sudoers entry.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 17:45:01 +07:00
112ab8c30a Add system shutdown/restart functionality via web interface
This commit adds the ability to safely shutdown or restart the Raspberry Pi
from the web interface, with proper sudo permissions and user confirmations.

Features:
- API endpoints for /api/system/shutdown and /api/system/restart
- System Control card in UI with shutdown and restart buttons
- JavaScript confirmation dialogs to prevent accidental shutdowns
- Shutdown has 1-minute delay, restart is immediate
- Auto-reload after restart (30 second delay)
- Sudoers file for passwordless sudo commands

Technical details:
- Uses subprocess.Popen() for non-blocking command execution
- Shutdown: 'sudo shutdown -h +1' (1 minute delay)
- Restart: 'sudo reboot' (immediate)
- Created wedding-phone-shutdown sudoers file
- Template version updated to 1.9.0

Installation required:
sudo cp wedding-phone-shutdown /etc/sudoers.d/wedding-phone-shutdown
sudo chmod 0440 /etc/sudoers.d/wedding-phone-shutdown

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 17:30:44 +07:00