A question of pmset

P

pmposse

Guest
Hi,

Firstly, great forum and I hope you guys can help!

I have several suites of macs running at a college. I want to shutdown all the macs at night as the students tend to leave them running. So far I have used the following command in terminal;

Code:
pmset repeat shutdown MTWRF 21:00:00

So, at 9pm each weeknight the macs will shutdown, fine. The problem however is that they tend to leave software running which then halts the shutdown, is there any way to force the macs to kill all the running software through pmset or should I be doing this another way?

I'm happy for anything open to be lost as basically they should have saved it.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
I wonder if cron might be a better solution here. I only suggest this since, with cron, you could use the shutdown tool to halt the machine which, at least in Linux (so I imagine it's the same in OS X), is ruthless and waits for nothing to close. Are you familiar with cron?
 
Joined
Apr 30, 2012
Messages
463
Reaction score
14
Points
18
Location
Wales, UK
Your Mac's Specs
I Mac 27-inch 3.2 GHz Intel Core i5 24GB ram. MacBook Pro 13-inch 2.5GHz dual-core Intel i5 16GB ram
Why don't you schedule them to shut down at a certain time.
Preferences>Energy Saver >Schedule.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Haha, this might have been an instance of over thinking this on my part. That should work as well.
 
OP
P

pmposse

Guest
Cheers for your fast responses!

Docx, the problem with the energy saver is that it basically calls pmset so still will not shutdown if any software is running. The reason I used the terminal command is that it does not appear in the energy saver control panel so can't be altered by users!

Vansmith, I have not used cron at all but I’ll have a look at it, cheers.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Take a look at cron. I use it to run a few things on a schedule and it works really well. With cron, you can also (as noted) use the shutdown tool to halt the machine which won't care if something is running (which appears to be what you want to accomplish).

Here's a nice cron tutorial on the Ubuntu wiki.
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
You could also build a stay open Applescript application, that runs in the background, and checks the
current system time every few minutes, and then closes all running apps when 9pm roles around,

I'm no Applescript expert, but I could post some code if your interested in that kind of solution.

Regards Mark
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
The only problem with an AppleScript solution is the ease with which it can be stopped. Any student at a machine could stop/quit an AS, thus precluding the shutdown process from ever happening.
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
Yes that is a possible problem, but I would have the app well hidden in a location that only
a system admin could access, and have it set up to start automatically when the computer starts.

But point taken, just an alternative though.

Mark
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top