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

    Shutting down the macbook command

    Scheduled Pinned Locked Moved Mac
    7 Posts 4 Posters 8.5k Views 1 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            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 Offline
              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 Offline
                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 Offline
                  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

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better đź’—

                  Register Login
                  • First post
                    Last post