Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automount triggered randomly #7

Open
ghost opened this issue Feb 18, 2017 · 9 comments
Open

automount triggered randomly #7

ghost opened this issue Feb 18, 2017 · 9 comments

Comments

@ghost
Copy link

ghost commented Feb 18, 2017

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
Copy link
Owner

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

  • Unload LaunchAgent via
    sudo launchctl unload ~/Library/LaunchAgents/it.niemetz.automount.plist
  • Install the new launchd (without KeepAlive and the WatchPath set to a specific file)
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>it.niemetz.automount</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/bin/automount.sh</string>
		<string>--mountall</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>WatchPaths</key>
	<array>
		<string>/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist</string>
	</array>
</dict>
</plist>
  • Load LaunchAgent via
    sudo launchctl load ~/Library/LaunchAgents/it.niemetz.automount.plist

@gniemetz
Copy link
Owner

Any updates on this?

@ghost
Copy link
Author

ghost commented Feb 21, 2017

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

@ghost
Copy link
Author

ghost commented Feb 21, 2017

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
Copy link
Author

ghost commented Feb 22, 2017

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
Copy link
Owner

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
Copy link
Author

ghost commented Feb 22, 2017

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
Copy link
Owner

gniemetz commented Feb 24, 2017

It seems it tricky to solve this problem :)

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

@gniemetz
Copy link
Owner

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

Repository owner deleted a comment from floatingdev Jan 31, 2024
Repository owner deleted a comment from H4wk-eye Feb 21, 2024
Repository owner deleted a comment from H4wk-eye Feb 21, 2024
Repository owner deleted a comment from H4wk-eye Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant