Easy on Off Desktop Timer for Mac
If you ever find yourself in a situation where you want to shut down your Mac after a time-consuming process has finished, such as downloading and installing updates, or exporting a video, what you need is a shutdown timer.
A few applications for this exist in the Mac App Store, such as Timer Boom and the aptly named Shutdown Timer. But you don't need any dedicated software. All you need is this simple trick.
Read more: If you're looking for a shutdown timer on Windows, there'sa quick tip for that, as well.
A built-in power schedule
UnderEnergy Saver settings, MacOS has a built-in wake and sleep schedule.
To enable it and create a schedule, go toSystem Preferences > Energy Saver and clickSchedule... in the lower right corner of the window. There you can set a time and day (weekends or weekdays, too) that the Mac will start up or wake, as well as a time and day(s) when it will restart, shut down or sleep.
As useful as the schedule feature is, it's limited in how it can work. Still, you could use it to shut down your computer at a specific time. Just select a time for the sleep or shutdown to happen after the process is expected to finish.
Make your own shutdown timer
If you want a shutdown timer that's more adaptable, you only need to know a few terminal commands.
Theshutdown command will, as expected, shut down your Mac when used in Terminal. But there are some important options that you will also want to use to make this shutdown timer meet your needs.
- -h will halt the system at a specified time.
- -r will reboot instead of shutdown.
- -s will put the Mac to sleep instead of shutdown.
There are other options, which you can read more about in Apple's shutdown documentation, but for the purpose of a shutdown timer,-h,-r and-s are likely all you will need to know.
If you remember this shutdown command, you can simply open Terminal and enter the command to create a shutdown timer. Some example shutdown timer commands would look like:
- A 15-minute shutdown timer:sudo shutdown -h +15
- A 30-minute restart timer:sudo shutdown -r +30
- A 1-hour sleep timer:sudo shutdown -s +60
When you enter one of these commands, you will need to enter the password for the user account and press return. The shutdown timer will then be created, giving you the exact time and date that the shutdown/restart/sleep process will occur. It will also give you the process ID, also known as apid, which is a three- to four-digit number.
If you wish to cancel a shutdown timer, take note of its pid and enter this command in Terminal:sudo kill [pid number].
Create a shutdown timer desktop shortcut
If you find yourself using the same shutdown timer often, you may want to create a desktop shortcut for the timer.
To do this, open TextEdit and clickNew Document. This opens a blank text document. If the document is not in plain text, presscommand + shift + T to switch to plain text.
On the very top line of the text file, type#!/bin/bash. This tells the operating system that the command should be executed using Bash.
Press return twice, and on the third line, enter your shutdown timer command, such assudo shutdown -h +15. Save the file to Desktop and give it a simple name, likeshutdown. Before clickingSave, make sure to uncheck the box besideIf no extension is provided, use ".txt". ClickSave.
Finally, we need to make the file executable. Open terminal and change directory to Desktop by typingcd /Users/[username]/Desktop and press enter. Next, typechmod 774 shutdown and press enter.
Now if you double-click the shutdown shortcut on your desktop, Terminal will open, prompting you to enter your user password. Once entered, the timer will begin.
If you want to replace the default icon of an executable file, click to highlight the icon and press command + I. This opens the info page for the shortcut. Open the image you want to use in Preview and press command + A to select all and command + C to copy. Lastly, in the info window for the shutdown timer, click the logo in the top left corner to highlight it, then press command + V to paste the image.
Source: https://www.cnet.com/tech/computing/how-to-put-a-sleep-timer-shortcut-on-your-mac-desktop/
0 Response to "Easy on Off Desktop Timer for Mac"
Post a Comment