Shutting down the macbook command
-
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?
-
@Ivan-Freitas, these commands shutdown a mac in 60 seconds, or now (immediately):
sudo shutdown -h +60 sudo shutdown -h nowWhile testing this, you can run the +60 command and be ready to run this command to cancel the shutdown:
sudo killall shutdownTo 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/shutdownYou 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.
-
@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
-
@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.
-
@Ivan-Freitas ```
osascript -e 'tell app "System Events" to shut down' -
@Ulisses-Honor It's really worked for me, just copy and paste on Gui Command Editor.
-
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"'
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