Skip to content

Bash script for automatic mount of a network disk when connection are available

License

Notifications You must be signed in to change notification settings

bigno/waitnetmnt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

waitnetmnt

Bash script for automatic mount of a network disk when connection are available.

Main features

  • Check if the disk is already mounted
  • Check if the path where the mount will be mounted exists
  • Check that the server (where the disk is exposed, i.e. via samba protocol) is available

Configurations

  • DRIVE_TO_MOUNT: This variable is an array that must contains the name(s) of the exposed "network drive(s)" that we desire to mount.
  • DRIVE_IP_ADDRESS: This variable is an array that must contains the IP address of the exposed "network drive(s)" that we desire to mount.
  • PATH_WHERE_MOUNT: This variable is an array that must contains the "absolute mount path(s)" that we desire to mount.
  • MOUNT_TYPE: This variable is an array that must define the "mount type" that will be used in the -t option of mount command.
  • MOUNT_OPTIONS: This variable is an array that must define the "mount options" that will be used in the -o option of mount command.
  • MAX_ATTEMPS: This variable is an integer value that define the maximum number of ping attempts the script will make before considering as "unavailable" IP address.
  • SLEEP_SECOND: This variable is an integer value that define the number of seconds that the script waits between a ping attempt and another.

Suggested use

The script can be used via crontab.

Tested environment

The script has been successfully tested on the following environments:

  • Raspberry Pi 3 with Raspbian Stretch distro.

About

Bash script for automatic mount of a network disk when connection are available

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages