following problem: I have a server which needs to mount a windows network share in order to copy a file on it.So I added the share in the fstab so that it will be mounted on startup. //192.168.1.xx/share   /mnt/networkshare   cifs    noperm,username=user,password=******    0   0A script loops to copy the file on the share like that:while [ true ]  do    if [ -f /path/to/the/file ]    then      mv /path/to/the/file /mnt/networkshare    fidoneThe problem is, that the windows computer is shutting down at night at starts in the morning. First, during this time, the load on the server is 100% on one core due to the while [true] script. Second, sometimes the mount is not working anymore after the startup of the windows computer. (a crontab * * * * * mount -a runs to mount all again) The files do not get copied and the mount is not accessible on the server. It needs to be restarted.How can I make sure that the mount is always there while the computer is on. Do I maybe need to somehow umount the share? I can umount it every night, but what if the windows computer gets restarted during the day? How can I pause the while [true] script if the mount is not there for lower cpu load on night?Thanks for your help!
Auto mounting network share which is temporary offline
networking;mount;fstab;cifs;automounting
you can check the mount before attempting to move:df | grep /mnt/networkshare |grep -v grep >/dev/null; r=${?}if [ ${r} -eq 0 ]then  mv /path/to/the/file /mnt/networksharefialso, adding a sleep command in the process might mitigate your 100% CPU utilization problem. Hammering a process without a break is not a good approach.