An argument for adding batch functionality to Hazel

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Hi,

This has been discussed before, but I'd like throw in a vote for turning Hazel into a general purpose batch processor.

If one wants to run batch processes in macOS today, you have three options
  • cron
  • launchd
  • Automator

Assuming that the majority of computers running macOS are laptops, and assuming that most laptops go into sleep mode every now and then, the scheduling solution has to support sleeps and it should support power offs. That leaves us with only launchd as an option for scheduling, and it only support "late runs" when in sleep mode, not in power off (doc). The other thing with launchd is of course that few people knows it; normal users will use Automator if they ever venture into batch processing, developers will use cron as that's what they're familiar with from other unix environments.

The only user friendly solution in the list above, Automator, relies on calendar events for scheduling, and so it can only be scheduled with "day" as the minimum interval for the schedule.

If you implement batch processing capabilities into Hazel, it can be the only user friendly solution that supports sleeps and supports custom intervals. It can also be the only option for batch processing supporting power off. I think even if you just made a frontend for launchd, that would be useful.

I agree that most use cases can be triggered by other events than time, but some can't. Here are some use cases that I would like to use Hazel for, but which I'm unable to because of lacking batch support.
  • Apple Photos does not sync smart folders across devices. Create a job that for every smart album creates a non-smart album and keeps them in sync.
  • Run a script every day. The script generates a PDF report and distributes it to a mailing list. The report should be generated at the end of every day (Automator could do this, but it doesn't support sleeps)
merol
 
Posts: 6
Joined: Sun Oct 01, 2017 9:24 am

Have you looked at the "Current time" attribute?
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for the tip. "Current time solves" most of my cases, I wasn't aware of it; I have to have it watch a dummy folder, but I guess that's ok. How does it behave if the computer is sleeping or powered off at the time stamp of "Current time"? How does it behave if multiple time slots has passed since last run?

I can use launchd for my hourly batch job. I think running rules on time triggers would be nice to have as a separate functionality, but I can see that the use cases might be few compared to the necessary time investment needed to implement it.
merol
 
Posts: 6
Joined: Sun Oct 01, 2017 9:24 am

It is not reliable if the machine is asleep. Hazel doesn't control whether the machine "wakes up" for power nap. If it misses an occurrence, it won't try and make up for it, instead waiting for the next time.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Open Discussion