Eject USB Disk

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Eject USB Disk Tue Sep 08, 2020 6:53 pm • by dennis.a
I recently got a large quantity of old floppy disks to sort through and pull anything useful off of. I've already got the workflow working properly except for ejecting the disk. Since each disk is unknown, I can't code in the name of the disk, nor do I want to interact with the workflow by picking from a list of disks to eject.

My current attempt is to run a shell script when the workflow finishes, but it seems to always pass the argument to the script even without me using it in the script. My script is very simple.

Code: Select all
diskutil unmount /dev/disk2


The error I get is "Error Processing file on the file Floppy Disk". The steps before the script copy the files, then rename the folder, so it's obviously passing the path to the newly renamed file to the script.

How can I tell the script to just eject the disk regardless of its name and ignore any arguments passed in?
dennis.a
 
Posts: 6
Joined: Thu Sep 08, 2016 5:48 pm

Re: Eject USB Disk Wed Sep 09, 2020 10:22 am • by Mr_Noodle
It doesn't matter what arguments are passed in. Unless you reference those arguments in the script, it won't do anything. Try the script outside of Hazel and try debugging it there.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Eject USB Disk Wed Sep 09, 2020 1:36 pm • by dennis.a
That's what confuses me. I have tried it outside of Hazel and it works just fine. But when it runs inside Hazel it fails with an error indicating the file was passed as an argument to the script. Even when I make an automator workflow and run it as a shell script inside that, it fails in Hazel with the same error.

I've tried putting a pause in the script in case it was trying to run while it was still copying, but it doesn't change anything. Here's a line from the log.

"[Error] Shell script failed: Error processing shell script on file /Users/dennis/Desktop/Floppy Disk Copies/Untitled."

And again the shell script is very simple. Just "wait 30 seconds and eject disk." No reference to an argument passed in.

Code: Select all
sleep 30
diskutil eject /dev/disk2
dennis.a
 
Posts: 6
Joined: Thu Sep 08, 2016 5:48 pm

Re: Eject USB Disk Thu Sep 10, 2020 10:14 am • by Mr_Noodle
Can you post the full text of the error? Also, when running it outside Hazel, try sending in arguments.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support