title: Script to check if wifi is connected
body: <p>In Max OS Mojave, is it possible to create a shell script or something similar that checks for an active wifi connection, and if not, disables wifi then re-enable?</p>
  
  <p>A little background. Basically I need to make sure that I can connect to my computer at home from anywhere. Normally this is no problem, but we have been having power outages with current storms and when the power comes back on, my Mac does not always reconnect to my wifi network (may have something to do with router, it is old). It's not a common problem, but I'll be darned if it doesn't happen at the most inconvenient times. In order to fix this, I simply have to disable wifi, then re-enable. This fixes the issue and the wifi auto reconnects. But I can't do that if I'm not at home.</p>
  
  <p>I've considered a script that runs every 20 minutes or so that disables wifi, then re-enables it using launchd which technically fixes my problem, however I don't want to have to keep disabling the script while using my Mac because if I don't disable it, I'll loose wifi every 20 minutes. </p>
  
  <p>Any information would be greatly appreciated.</p>