Amazon.co.uk Widgets

Log in

X
Compact Cassette logo

pmset is a swiss army knife of functionality for sleep, standby, UPS, scheduled event, and power source debugging, The examples in the man page show some uses of most of them. My remote mac is a desktop without an uninterruptible power supply (UPS) so I need a simple power regime to make sure my Mac mini is on for remote backup when I need it to be online - this is exactly what used to be possible via System Settings.

pmset -g

Lets first check what is currently set on my Mac, upgraded from macOS Monterey to macOS Sonoma. (Annotations mine)

% pmset -g
System-wide power settings:
Currently in use:
 disksleep            10 - Disk spindown timer; (value in minutes, or 0 to disable)
 powernap             1  - Enable/disable Power Nap on supported machines (value = 0/1)
 womp                 1  - Same as "Wake for network access" in System Settings.
 networkoversleep     0  - This setting is not used by all platforms; changing its value is unsupported
 sleep                10 - (sleep prevented by sharingd, powerd, bluetoothd)
 Sleep On Power Button 1 - Not documented 
 ttyskeepawake        1  - prevent idle system sleep when any tty is 'active'. (value = 0/1)
 tcpkeepalive         1  - Not documented 
 autorestart          1  - automatic restart on power loss (value = 0/1)
 standby              0  - kernel power management to automatically hibernate (setting visible if the feature is supported on this machine)
 displaysleep         10 - display sleep timer (value in minutes, or 0 to disable)

Not sure if ttyskeepalive respects Apple Remote Dektop (ARD), but I hope so! The disksleep parameter seems a bit weird. All Mac computers have been SSD for years now. There is no disk to 'spindown'. And standby is a bit weird too. This is a Mac mini - it wouldn't normally hibernate. Ignoring these for now. 

pmset scheduled events

pmset allows you to schedule system sleep, shutdown, wakeup and/or power on. schedule is for setting up one-time power events, and repeat is for setting up daily/weekly power on and power off events. Note that you may only have one pair of repeating events scheduled - a "power on" event and a "power off" event. For sleep cycling applications, pmset can schedule a "relative" wakeup or poweron to occur in seconds from the end of system sleep/shutdown, but this event cannot be cancelled and is inherently imprecise" - Source: pmset Man page

type - one of sleep, wake, poweron, shutdown, wakeorpoweron
date/time - "MM/dd/yy HH:mm:ss" (in 24 hour format; must be in quotes)
time - HH:mm:ss
weekdays - a subset of MTWRFSU ("M" and "MTWRF" are valid strings)
owner - a string describing the person or program who is scheduling this one-time power event (optional)

This is obtuse for 2023. Weekdays have letters to describe them, in a way so as to have a unique letter for each day. Old school Unix I guess. Not very 'global'. Anyway, for my purposes for one particular Mac Mini I want it to power on on Saturday at 09:00 and shutdown at 21:00 so the command which has to be run by sudo is :-

sudo pmset repeat wakeorpoweron S 09:00:00 shutdown S 21:00:00

You can check that is set correctly using % pmset -g sched

% pmset -g sched                                                
Repeating power events:
  wakepoweron at 9:00AM Saturday
  shutdown at 9:00PM Saturday
...

And for another Mac I want the machine to wake each morning in time for my morning routine.

% sudo pmset repeat wakeorpoweron MTWRFSU 09:00:00 shutdown MSU 18:30:00                  
% pmset -g sched                                                        
Repeating power events:
  wakepoweron at 9:00AM every day
  shutdown at 6:30PM Some days
...

Now that is set I can go ahead and configure my backup regime content that my machine will be up all day Saturday to run it. That's another story..

Licences, trademarks, source code licences and attributions

Licences, trademarks, source code licences and attributions

Multizone and this site is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited licence granted by Open Source Matters, Inc. 928uk® is a trademark of Multizone Limited, registered in the UK. AdMob™, AdSense™, AdWords™, Android™, Chrome OS™, Chromebook™, Chrome™, DART™, Flutter™, Firebase™, Firestore™, Fuchsia™, Gmail™, Google Maps™, Google Pixel™, Google Play™, Pixelbook Go™, and Pixel™ and other trademarks listed at the Google Brand Resource center are trademarks of Google LLC and this site is not endorsed by or affiliated with Google in any way. Apple and the Apple logo are trademarks of Apple Inc., registered in the U.S. and other countries. App Store is a service mark of Apple Inc. The OSI logo trademark is the trademark of Open Source Initiative. Microsoft, CoPilot, Microsoft 365, Microsoft Teams, and Windows are trademarks of the Microsoft group of companies. ROKU, the ROKU Logo, STREAMING STICK, ROKU TV, ROKU POWERED, the ROKU POWERED Logo, ROKU READY, the ROKU READY Logo, the purple fabric tag design,and the purple d-pad design are trademarks and/or registered trademarks of Roku, Inc. in the UK, the United States and other countries. UNIX® and the X® logo are registered trademarks of The Open Group. Any other product or company names may be trademarks™ or registered® trademarks of their respective holders. Use of these trademarks in articles here does not apply affiliation or endorsement by any of them.

Where the source code is published here on ezone.co.uk or on our GitHub by Angus Fox, Multizone Limited it is licenced according to the open source practice for the project concerned.

BSD 3-Clause "New" or "Revised" Licence
Original source code for mobile apps are licenced using the same licence as the one used by "The Flutter Authors". This Licence, the BSD 3-Clause "New" or "Revised" Licence (bsd-3-clause) is a permissive licence with a clause that prohibits others from using the name of the project or its contributors to promote derived products without written consent.
GNU General Public Licence v2.0 or later
Original source code for Joomla! published here on ezone.co.uk by Angus Fox, Multizone Limited is licenced using the same licence as the one used by Joomla!. This Licence, the GNU General Public Licence Version 2 or later (gpl-2.0) is the most widely used free software licence and has a strong copyleft requirement. When distributing derived works, the source code of the work must be made available under the same licence.

You can use any code you find here, just respect the licences and dont use the name of this site or our company to promote derived products without written consent. I mean, why would you? You're not us!

Amazon Associate
As an Amazon Associate we earn from qualifying purchases.
Logo
Our Logo Image is by Freepik. We chose it because its an M and also the letter A twice - and that represents us.