Is there any way to programmatically check if a connection is established to an afp server? I have tried pinging the server but that always results in a timeout.
So far the only workaround that I've gotten to work is:
#!/bin/bash
open "afp://website.com/afpDir/"
until [[ -d /Volumes/afpDir/ ]]; do
echo 'waiting for connections'
sleep 1
done
However, this only works if I specifically check for the afpDir
directory while it is open in Finder. Is there a reliable way to to check if there is a connection to that afp server or perhaps even finding a reliable ip for the server?
mount
command return on your system - both when the AFP server is connected and disconnected? – Scot Oct 26 '17 at 21:50//username@website.com/homedir on /Volumes/homedir (afpfs, nodev, nosuid, quarantine, mounted by localuser)
and it's gone when I unmount. – Micks Ketches Oct 27 '17 at 17:05mount
and parsing the results is another possibility. – Scot Oct 27 '17 at 22:37