Page 1 of 1
Smart folders and shell script
Posted:
Sun Dec 01, 2024 3:16 pm
by tinyux
I've got a weird issue where tests with a shell script where I'm doing a basic unarchive via unar vs the OS 'unarchive' complete perfectly. However when I use the same script and copy the rule over to a smart folder saved search, I'm receiving an exit status code of 1 for a shell script failure in the hazel logs.
Using
- Code: Select all
bin/bash
with the following in both:
- Code: Select all
/opt/homebrew/bin/unar -q -s "$1"
Re: Smart folders and shell script
Posted:
Mon Dec 02, 2024 10:42 am
by Mr_Noodle
Turn on debug mode as described here:
https://www.noodlesoft.com/kb/hazel-debug-mode/After that, check the logs to see any output from the script.
Re: Smart folders and shell script
Posted:
Mon Dec 02, 2024 12:29 pm
by tinyux
Thanks, that was actually helpful. It appears to be saying that it can't create directories? Why would the shell script be able to create directories from a test folder I dumped some of the same files into... but not when its getting proper paths from a smart folder list?
So this seems more like a shell script permissioning issue with smart folders? Than it is directly a Hazel issue it would appear but I can't really elevate the permissions with sudo without a prompt so if its running headless through Hazel I'm not sure how to overcome that as the "Unarchive" function in Hazel doesn't seem to be handling everything I've got like 7zip files, and something like Unarchiver while it handles them likes to load EVERYTHING into memory even after it's decompressed them that Hazels more metered approach is great for a silent background task operation where I can just let it run, but I need the smart folder to more easily traverse the folders per previous Hazel recommendations.
Any advice would be appreciated.
Re: Smart folders and shell script
Posted:
Tue Dec 03, 2024 9:37 am
by Mr_Noodle
Where are the files located? See if there's a pattern to which locations it fails on.
Re: Smart folders and shell script
Posted:
Fri Dec 06, 2024 1:26 pm
by tinyux
The pattern is it literally fails on every single file. The files are located across a variety of folders on a hard drive. While they're contained in one folder I thought I'd read that its best to use smart folders such that Hazel isn't having to traverse every single folder and subfolder to find them all.
I ended up basically brute forcing this and abandoning the fully automated shell script just to get it done and fed the files in with an open app action which required some user intervention so not what I'd preferred but it was able to get the job done. I've tested a couple other scripts that definitely work when traversing a folder, but fail when running hazel through a smart folder. It's as if the smart folder is invoking some need for more elevated permissions where as running the same script against a regular folder the script has the permissions it needs to write files and create folders... something it can't do when the folder path is passed along in a smart folder? I can pretty easily reproduce this at this point and just went with a workaround. If it's an OS limitation that's fine just trying to figure it out.
Re: Smart folders and shell script
Posted:
Mon Dec 09, 2024 9:36 am
by Mr_Noodle
Is this drive your local drive or an external one? Can Hazel do other actions on that drive?