TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Shutting down the macbook command

    Mac
    4
    7
    6.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Ivan FreitasI
      Ivan Freitas
      last edited by

      What command do I use to turn off my macbook via triggercmd? I have already tested several including the windows and cmd commands with "sudo" in the trigger and nothing works, could someone help me?

      RussR Ulisses HonorU 2 Replies Last reply Reply Quote 0
      • RussR
        Russ @Ivan Freitas
        last edited by Russ

        @Ivan-Freitas, these commands shutdown a mac in 60 seconds, or now (immediately):

        sudo shutdown -h +60
        sudo shutdown -h now
        

        While testing this, you can run the +60 command and be ready to run this command to cancel the shutdown:

        sudo killall shutdown
        

        To use the shutdown command with TRIGGERcmd, you'll need to allow it to run without a password prompt. To do that, add this line to your sudoers file:

        ALL ALL=(ALL) NOPASSWD: /sbin/shutdown
        

        You can edit your sudoers file with visudo or nano. To use nano, you'll need to switch to the root user first with sudo su -, then run nano /etc/sudoers

        EDIT: I stand corrected. See @Ulisses-Honor's solution below. That's much simpler.

        Russell VanderMey

        1 Reply Last reply Reply Quote 0
        • Ivan FreitasI
          Ivan Freitas
          last edited by

          @Russ said in Shutting down the macbook command:

          sudoers

          I tried to do this configuration, but as I don't understand enough, I don't know how to configure this sudoers

          RussR 1 Reply Last reply Reply Quote 0
          • RussR
            Russ @Ivan Freitas
            last edited by Russ

            @Ivan-Freitas, this video might help: https://youtu.be/cbjNMyqM4rE?t=44

            It shows how to open the sudoers file with the visudo command. Once you've opened it, press the i button to go into edit mode, and press the ESC button to exit edit mode after you've added that line. Then type :wq, and press enter to save and exit.

            EDIT: Nevermind. To shutdown you can use @Ulisses-Honor's osascript command below.

            Russell VanderMey

            1 Reply Last reply Reply Quote 0
            • Ulisses HonorU
              Ulisses Honor @Ivan Freitas
              last edited by

              @Ivan-Freitas ```
              osascript -e 'tell app "System Events" to shut down'

              Ulisses HonorU 1 Reply Last reply Reply Quote 2
              • Ulisses HonorU
                Ulisses Honor @Ulisses Honor
                last edited by

                @Ulisses-Honor It's really worked for me, just copy and paste on Gui Command Editor.

                1 Reply Last reply Reply Quote 0
                • D
                  DecoLMS
                  last edited by DecoLMS

                  Hi guys, here's a script I set up to simulate the standard Mac shutdown. I hope you like it!

                  osascript -e 'tell application "System Events" to click menu item "Shutdown…" of menu 1 of menu bar item "Apple" of menu bar 1 of process "Finder"'

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post