0

I plan to deploy a kiosk with no keyboard and mouse. Can anyone think of a way to allow safe shutdown? I think the power button will put up a user prompt that requires a keyboard or mouse. The only thing I could think of was a usb enter key. This is silly so I'm asking for help.

  • Is it going to be connected to the network? – user3052786 Jan 10 at 6:53
  • Yes! However it is at a remote location so inbound communication is a no-go. – jorfus yesterday
  • Kind of having trouble imagining what the setup looks like but there are ways to overcome NAT issues with remote admin software (having the client check in to a task server on ARD, etc.) Are you sure you need safe shutdown though? In a kiosk type configuration I can't see why you couldn't just long press power to shutdown – user3052786 yesterday
  • Imagine your business model is to put a machine in every customer location. You control the machine but not the network. Long press is not a safe shutdown. It does not unmount the drive. I would like to avoid "no boot" situations that can happen with repeatedly shutting down a machine without unmounting the boot drive first. – jorfus 8 hours ago
  • I doubt forced shutdowns would do that to an idle system... maybe a longer boot up time when you turn it back on sure, but apart from losing data from unsaved files, shouldn't be a big problem (it's not the same thing as pulling the plug while it's running) Anyhow, this app might be of interest, you can remap the power button to act as the return key – hold power to get the dialogue to show up then press again to shut down – user3052786 6 hours ago
0

Found an answer here with applescript

on idle
set i to 0

tell application "System Events"

    -- Get a count of all the windows belonging to the process
    set numberOfWindows to count windows of process "loginwindow"

    -- Check each window for a "Shut Down" button....
    repeat numberOfWindows times
        set i to i + 1

        -- ....and shut down if found
        if exists button "Shut Down" of window i of process "loginwindow" then
            click button "Shut Down" of window i of process "loginwindow"
        end if
    end repeat
end tell

-- How often the script checks for the window (in seconds). Change it as you see fit.
return 7
end idle

Haven't tested it yet, but it sounds reasonable.

edit
Option 2 Super simple (assuming no open applications will prompt for user interaction first)

tell app "System Events" to shut down

Option 3 (variation on option 1)

tell application "System Events" to set the visible of every process to true

set white_list to {"Finder"}
set white_list to {"Shutdown"}

try
  tell application "Finder"
      set process_list to the name of every process whose visible is true
    end tell
    repeat with i fron 1 to (number of items in process_list)
      set this_process to item i of the process_list
      if this_process is not in white_list then
        tell application this_process
          quit
        end tell
        end if
    end repeat
on error
    tell application "finder"
    shutdown
    end tell
end try
delay 2
tell application "Finder"
  shut down
end tell

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.