Jump to content

Trigger actions remotely with SSH?


Dr.Peril

Recommended Posts

Hey all,

I'm wondering if it's possible to trigger Alfred via SSH?

I would like to trigger the Ejectall feature from shortcuts on my iPhone with the "Run script over SSH" function.

 

I've found some terminal commands to eject all disks like:

find /Volumes -maxdepth 1 -not -user root -print0 | xargs -0 diskutil eject

but it chokes if /Volumes has a network share attached... :S 

Thanks for the help!

Link to comment

Oh, apologies, yeah there are a ton of Eject Disk shortcuts, I grabbed some Apple Script as mentioned and put it into a shortcut. Just wanted to 'post a solution' ¯\_(ツ)_/¯ 

I guess that makes this entire thread kinda moot since I didn't land on using Alfred but... maybe someone else will find this useful:

 

-- Copy of script b/c editing on iPhone sometimes nulls that block.
to ejectAllDisk()
	try
		tell application "Finder"
			-- Prevent unmounting full disks, those generally are mounted backup snapshots etc.
			eject (every disk whose ejectable is true and free space is not equal to 0)
		end tell
	on error
		display notification "Failed to eject all disks" with title "Eject all disks" subtitle "Failure"
	end try
end ejectAllDisk

-- this is the entry method.
on run
	try
		with timeout of 30 seconds
			ejectAllDisk()
		end timeout
	on error
		display notification "Eject is still in progress" with title "Eject all disks" subtitle "Timeout"
		ejectAllDisk()
	end try
end run

 

Edited by Dr.Peril
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...