Comments (7)
I was working on this today and have it working in principle.
I'm reading the output of /usr/bin/log stream --predicate 'subsystem == "com.apple.TimeMachine"' --info
using a Process() and Pipe(), using regex to parse the log string, then firing a notification depending on the message content.
2022-05-21 19:28:21.720633-0700 0x10e421 Info 0x186886 75012 0 backupd: (TimeMachine) [com.apple.TimeMachine:General] Completed backup: 2022-05-21-192820
let logParserPattern = #"""
(?<timestamp>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d{6}-\d{4})
\s+
(?<thread>0x\w+)
\s+
(?<type>\w+)
\s+
(?<activity>0x\w+)
\s+
(?<pid>\d+)
\s+
(?<ttl>\d+)
\s+
(?<context>.*?)
\s
\[(?<namespace>.*?):(?<namespacecontext>.*?)\]
\s+
(?<message>.*)
"""#
I'm still figuring out how to handle "Cleaning Up..." ("thinning") which happens after the Completed backup
log message.
2022-05-21 19:28:21.763071-0700 0x10e421 Info 0x186886 75012 0 backupd: (TimeMachine) [com.apple.TimeMachine:BackupThinning] Thinning 2 backups using age-based thinning, expected free space: 674.59 GB actual free space: 674.59 GB trigger 50 GB thin 83.33 GB dates: (
"2022-05-21-172136",
"2022-05-21-175757"
)
This doesn't seem to have an explicit "complete" log message but is usually followed by:
2022-05-21 19:35:09.029014-0700 0x10e421 Info 0x186886 75012 0 backupd: (TimeMachine) [com.apple.TimeMachine:General] Mountpoint '/Volumes/8tb' is still valid
but that message is also sometimes logged during cleanup.
So I think I'm going to use tmutil status
when I see that to ensure Time Machine is really complete and the disk is really ready to unmount.
Backup session status:
{
ClientID = "com.apple.backupd";
Running = 0;
}
If anyone knows a real API I should be using for this (instead of parsing text logs and calling shell commands!) let me know.
I'll take another look at this soon and make a PR.
from ejectify-macos.
tmutil
let you know if a backup is running or not using tmutil status
or tmutil currentphase
.
Using tmutil listbackups
list all backup made recently and tmutil latestbackup -t
give you the date of the last one.
This allow to check if a backup was made recently and unmnunt the disk if that the case and no backup are running. To start the backup right after the disk is mounted tmutil startbackup
.
ejectify could mount the disk every X hours and unmount the disk when the backup is done.
The settings could be like "Time Machine Backup" -> "every 1 hours", "every 6 hours", "every 12 hours", "every day"
from ejectify-macos.
I'm closing this issue as I consider it out-of-scope for Ejectify. I would recommend reaching out to the developer behind TimeMachineEditor and asking if he could add a mechanism to automatically unmount the volume when Time Machine is done making a backup.
from ejectify-macos.
Thanks for the suggestion 👍.
from ejectify-macos.
This would be really great!
from ejectify-macos.
Maybe you could have a look at how this tool is doing it: https://github.com/ProsoftEngineering/TimeMachineRemoteStatus
from ejectify-macos.
I've been working on this more recently: BrianHenryIE/UnmountVolumeAfterTimeMachine
from ejectify-macos.
Related Issues (20)
- Settings are unclear (to me) HOT 2
- Eject disk when power source switch from AC to battery HOT 10
- Compatibility with Ventura HOT 3
- Check Mount Point of Drive HOT 4
- When re-mount add drive to Spotfire ignore list again HOT 1
- Add support for NTFS (via Tuxera) volumes HOT 2
- link is dead, where to download Ejectify? HOT 1
- Time Machine volume not automatically remounting HOT 9
- Remount HOT 1
- Option to close/reopen application that is using a given drive that you need to unmount HOT 2
- Ejectify seems to fail working with non-admin accounts HOT 7
- Custom eject scenarios HOT 3
- Don't show Ejectify running in Activity Monitor after reboot?? HOT 3
- Option to Mount Disks on Click HOT 3
- Notification when disks have been ejected
- Eject Specific Volume at a Specific Time
- Launch at Login Not working HOT 5
- Mount only after the display turns on HOT 10
- Can't restore my purchase HOT 1
- Play sound when volume has been ejected
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ejectify-macos.