I have a network attached storage (NAS) at home where I store pretty much all my media stuff (songs, videos, etc). I would like to mount it to a local directory in my notebook automatically every time I login at home so before mounting it I need to do a ping to see if it is answering (which means I'm home).
I already have the script to mount it (see below) but I have two questions:
1) How to use the answer from ping in order to see if its answering? I believe I have to use grep together with the ping command, but since I'm a new *nix user I'm not very fluent with it yet.
2) Where is the best place to put this script?
The mount command I have is this:
sudo mount -t cifs //myIpAddress/remoteDir /media/MyLibrary -o username=myUsername,password=myPassword,domain=myDomain,iocharset=utf8,file_mode=0777,dir_mode=0777