diff --git a/rotary_phone_web.py b/rotary_phone_web.py index 4bbf6bd..16ca732 100644 --- a/rotary_phone_web.py +++ b/rotary_phone_web.py @@ -981,7 +981,7 @@ def api_system_shutdown(): try: import subprocess # Schedule shutdown in 1 minute to allow response to be sent - subprocess.Popen(['sudo', 'shutdown', '-h', '+1']) + subprocess.Popen(['sudo', '/sbin/shutdown', '-h', '+1']) return jsonify({"success": True, "message": "System will shutdown in 1 minute"}) except Exception as e: return jsonify({"success": False, "error": str(e)}), 500 @@ -992,7 +992,7 @@ def api_system_restart(): try: import subprocess # Schedule restart to allow response to be sent - subprocess.Popen(['sudo', 'reboot']) + subprocess.Popen(['sudo', '/sbin/reboot']) return jsonify({"success": True, "message": "System will restart shortly"}) except Exception as e: return jsonify({"success": False, "error": str(e)}), 500 diff --git a/wedding-phone-shutdown b/wedding-phone-shutdown index aa0c141..59845fd 100644 --- a/wedding-phone-shutdown +++ b/wedding-phone-shutdown @@ -4,5 +4,6 @@ # 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/shutdown -h +1 +berwn ALL=(ALL) NOPASSWD: /sbin/shutdown -h now berwn ALL=(ALL) NOPASSWD: /sbin/reboot