0

I've been battling with this for a while with mixed results. I frequently move my laptop between it's dock (wired) and my couch (wireless). Anytime I switch networks, I have to manually run "sudo mount -a" to get my shares back. It's not a huge deal, but I'd like to fix it.

Here's my fstab right now:

//192.168.0.50/backup /media/backup cifs iocharset=utf8,sec=ntlm 0 0 
//192.168.0.50/videos /media/videos cifs iocharset=utf8,sec=ntlm 0 0 
//192.168.0.50/dvr /media/dvr cifs iocharset=utf8,sec=ntlm 0 0 
//192.168.0.50/apps /media/apps cifs iocharset=utf8,sec=ntlm 0 0 
//192.168.0.50/music /media/music cifs iocharset=utf8,sec=ntlm 0 0 
//192.168.0.50/temp /media/temp cifs iocharset=utf8,sec=ntlm 0 0 

Ideas?

Bonus info: when I switch to the wired connection, I have to manually use the network indicator icon to disable networking, and re-enable it.

Big Millz
  • 325
  • To run a script after a connection has been established, look here: http://askubuntu.com/questions/13963/call-script-after-connecting-to-a-wireless-network – davidbaumann May 23 '15 at 16:44

1 Answers1

2

You can add script in /etc/network/if-up.d/ and when wlan0 go up call script witch will do sudo mount -a.

Make script called script with execute permissions 755

sudo nano /etc/network/if-up.d/script

# Check for specific interface if desired
[ "$IFACE" != "wlan0" ] || exit 0
# Do something
sudo mount -a
2707974
  • 10,553
  • 6
  • 33
  • 45
  • If I drop the [ "$IFACE" != "wlan0" ] || exit 0 line, will it run this everytime a connection goes up? I need to do it when eth0 goes up too. – Big Millz May 23 '15 at 20:55
  • Will do every time when wlan0 go up. For eth0 create one more script on the same plaxe. Only change interface name from wlan0 to eth0. – 2707974 May 23 '15 at 22:31