Prevent OS X from powering off, via CLI I use maid to run a few maintenance scripts regularly, via launchd. The time I chose for those tasks to run makes it very likely that I won’t suddenly decide to turn off my computer around then, but one can never be absolutely certain.

Sometimes, GUI apps prevent the computer from turning off due to unsaved changes. Can we replicate this via CLI? A bit like caffeinate but for power off instead of sleep.
How about actually using a GUI app to make an unsaved document?

osascript -e '
    tell application "TextEdit"
        activate
        set d to (make document)
        set text of d to "Your script is still running!"
    end tell
'