Open ghost opened 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
sudo launchctl unload ~/Library/LaunchAgents/it.niemetz.automount.plist
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>
sudo launchctl load ~/Library/LaunchAgents/it.niemetz.automount.plist
Any updates on this?
Sorry for the delay! I was travelling since last week and just returned home. Will try it tonight!
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!
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?
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
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.
It seems it tricky to solve this problem :)
Maybe http://superuser.com/a/626919/325746 could help (only the watchpaths)?
Sleepwatcher from http://www.bernhard-baehr.de/ looks promising, i will test it the next days, this could be a solution
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?