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

Shutting down the macbook command

Mac
4
7
6.7k
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.
  • I
    Ivan Freitas
    last edited by May 31, 2020, 2:09 PM

    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?

    R U 2 Replies Last reply May 31, 2020, 2:59 PM Reply Quote 0
    • R
      Russ @Ivan Freitas
      last edited by Russ Jun 27, 2020, 4:22 PM May 31, 2020, 2:59 PM

      @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
      • I
        Ivan Freitas
        last edited by May 31, 2020, 3:44 PM

        @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

        R 1 Reply Last reply May 31, 2020, 4:05 PM Reply Quote 0
        • R
          Russ @Ivan Freitas
          last edited by Russ Jun 27, 2020, 4:23 PM May 31, 2020, 4:05 PM

          @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
          • U
            Ulisses Honor @Ivan Freitas
            last edited by Jun 22, 2020, 6:00 PM

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

            U 1 Reply Last reply Jun 22, 2020, 6:02 PM Reply Quote 2
            • U
              Ulisses Honor @Ulisses Honor
              last edited by Jun 22, 2020, 6:02 PM

              @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 Aug 15, 2020, 3:10 PM Aug 15, 2020, 3:10 PM

                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