I often mount a remote drive using sshfs. I would love to have this mount automatically. However, if I mount it in my .bashrc or startup scripts, the mount often fails because my wireless internet connection has not yet been made.
Does anybody know of an easy way to execute a bash scrip every time the connection is made, or to auto-mount an sshfs drive?
Add your script to
/etc/network/if-up.d/. Name your script without a '.sh' extension.
Also after adding script run
chmod +x /etc/network/if-up.d/yourscriptnameto give necessary permission.
Make sure the network interface (e.g. wlan0 or eth0) that should trigger your script when turned on is mentioned in the file