Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eject disk when power source switch from AC to battery #42

Open
YangJianchong opened this issue Aug 2, 2022 · 10 comments
Open

Eject disk when power source switch from AC to battery #42

YangJianchong opened this issue Aug 2, 2022 · 10 comments
Labels
enhancement New feature or request

Comments

@YangJianchong
Copy link

Hi,

I'm using a Mac mini with an APC backup UPS at home.

I'm a bit worried about that when I'm not at home and there's a power outage, after the UPS battery drained out, or due to Energy Saver schedule, Mac just shuts down hard without safely ejecting all my external drive.

I hope ejectify can listen to some sort of 'power source switching to UPS' system event and safely eject all my external drives.

Hope I expressed myself clearly.

@nielsmouthaan nielsmouthaan changed the title Feature Request: Eject disk when power source switch from grid to UPS Eject disk when power source switch from grid to UPS Aug 2, 2022
@nielsmouthaan nielsmouthaan added the question Further information is requested label Aug 2, 2022
@nielsmouthaan
Copy link
Owner

How is your disk connected to your Mac? Directly or via a hub (which can also be an external display)?

@YangJianchong
Copy link
Author

How is your disk connected to your Mac? Directly or via a hub (which can also be an external display)?

Both. Some are connected directly to the Mac and the others connected via hub(which has its own power source also connected to the UPS).

@nielsmouthaan
Copy link
Owner

Ejectify needs to be able to unmount the volumes before the (external) disks lose power. That will be the case for those connected directly to your Mac. I cannot say whether that's also the case for those connected to the hub. If the hub or disks loses power before your Mac (because the UPS is empty), Ejectify won't have unmounted the volumes. Somehow the UPS should notify your Mac that its power is critically low so that your Mac can safely unmount (external) volumes. Do you know whether your UPS supports such a notification mechanism?

@YangJianchong
Copy link
Author

Thank you for replying.

I forgot to tell you that my UPS has a USB cable which connects to my Mac so the Mac can read the UPS's battery percentage (shown as images below). Is this the mechanism you are talking about?

Screen Shot 2022-08-06 at 1 16 55

Screen Shot 2022-08-06 at 1 23 53

Screen Shot 2022-08-06 at 1 22 48

@nielsmouthaan
Copy link
Owner

So your Mac shuts down when the UPS battery is critically low? In that case, you should be good: connected volumes will be unmounted safely as part of the shutdown process of macOS.

@YangJianchong
Copy link
Author

So your Mac shuts down when the UPS battery is critically low? In that case, you should be good: connected volumes will be unmounted safely as part of the shutdown process of macOS.

TL;DR: I did some test yesterday. I'm afraid that Energy Saver cannot control the the Mac to perform a normal shutdown process as it's scheduled.

I scheduled my Mac to shutdown when time remaining on UPS is 5min and when UPS battery level is below 5% and I pull off the UPS's power cable from the wall to simulate a power outage situation and let the Mac use UPS's power, with an external disk connected directly to it. Then I found out that the battery percentage reading of the UPS is inaccurate and not reliable, and even though the battery percentage become 0% the Mac is still running. Finally the Mac shutdown suddenly and I heard the sound by external hard drive's actuator arm returning to the position immediately. That indicates the hard drive is still spinning and working.

@nielsmouthaan
Copy link
Owner

That's odd; something is wrong with your Mac starting to sleep based on the UPS having a critically low battery level? I would suggest contacting the manufacturer of your UPS to receive support regarding this matter.

@YangJianchong
Copy link
Author

Thank you, I'll reach for manufacture's help about the UPS.
But will Ejectify be able to take action before the Mac shuts down on its own because of the power source changing? Since the change itself can be detected by macOS everytime.

@nielsmouthaan
Copy link
Owner

So unmount when switching from AC to battery?

@YangJianchong
Copy link
Author

Yes exactly.

@nielsmouthaan nielsmouthaan changed the title Eject disk when power source switch from grid to UPS Eject disk when power source switch from AC to battery Aug 18, 2022
@nielsmouthaan nielsmouthaan added enhancement New feature or request and removed question Further information is requested labels Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants