gniemetz / automount

Mount shares at login
MIT License
40 stars 6 forks source link

automount triggered randomly #7

Open ghost opened 7 years ago

ghost commented 7 years ago

Hello Gerd

After using automount for two days on my machines, I see it triggered a little too often. One machine is an iMac connected solely via Ethernet, the second one is a Macbook.

While the main events for triggering seem to work fine (change of network, reboot, waking from sleep (?)), automount gets triggered while nothing changes. I can't see a pattern, it seems randomly. Sometimes multiple times in a row.

Are the events that trigger the script logged? Can we see what happens there?

gniemetz commented 7 years ago

This also happens to me sometimes, unfortunately I don't know how to log the events that trigger the script. Try this workaround

gniemetz commented 7 years ago

Any updates on this?

ghost commented 7 years ago

Sorry for the delay! I was travelling since last week and just returned home. Will try it tonight!

ghost commented 7 years ago

Little update … I couldn't wait and updated on my Macbook. ;-) So far so good. After the first hour, automount just did as supposed to. When I trigger a network event (join/switch wifi, connect/disconnect VPN) the script runs – besides that I don't get any messages.

I will install it on my iMac tonight and report back!

ghost commented 7 years ago

Installed it on second Mac last night. After using both machines for the whole evening, it still triggers without obvious reasons, though less often. The Macbook is connected through Wifi, the iMac through ethernet.

Isn't there the possibility to protocol launchd with all triggers/events?

gniemetz commented 7 years ago

Unfortunately i don't know a way to log when or why a script is started via launchd :( But it should only run when logging in or when the file /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist changes (that is when a network configuration changes). In your case some process is touching/writing to this file so the script gets triggered, maybe a fs_usage -w | grep /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist could help

ghost commented 7 years ago

When I let fs_usage run, it doesn't generate output when I do manual changes to the network interfaces like switching on/off wifi or changing between static IP and DHCP.

screenshot 2017-02-22 11 08 22

gniemetz commented 7 years ago

It seems it tricky to solve this problem :)

Maybe http://superuser.com/a/626919/325746 could help (only the watchpaths)?

gniemetz commented 7 years ago

Sleepwatcher from http://www.bernhard-baehr.de/ looks promising, i will test it the next days, this could be a solution