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>
This commit is contained in:
8
wedding-phone-shutdown
Normal file
8
wedding-phone-shutdown
Normal file
@@ -0,0 +1,8 @@
|
||||
# Allow wedding-phone user to shutdown and reboot without password
|
||||
# Copy this file to /etc/sudoers.d/wedding-phone-shutdown
|
||||
# Usage: sudo cp wedding-phone-shutdown /etc/sudoers.d/wedding-phone-shutdown
|
||||
# Then: sudo chmod 0440 /etc/sudoers.d/wedding-phone-shutdown
|
||||
|
||||
# Allow user to run shutdown and reboot commands without password
|
||||
berwn ALL=(ALL) NOPASSWD: /sbin/shutdown
|
||||
berwn ALL=(ALL) NOPASSWD: /sbin/reboot
|
||||
Reference in New Issue
Block a user