Example: mount the shared directory of the server to the local Ubuntu directory.

Source: Internet
Author: User

#! /Bin/bash


: <Test

'

History: 2013.04.12 | 2012.12.06 | 2013.06.20

Title: mount the shared directory of the server to the local Ubuntu directory.

Noter: Mount different server by the input short name.

-> Format: sudo Mount-T smbfs // ip/server_folder/locate_mount_folder/-O iocharset = utf8, uid =$ {user}, Gid =$ {user }, umask = 022, username = usname, password = passwd

-> 201212061722 first release by N.

-> 201304121630 version2 update done by N.

-> Ver06.20.2013 update details rules.

-& Gt; 20130705 join in ssvm version manager.

-> This command must be supported by Samba and smbfs.

-> Split the mount command into four segments.

-> Part_ I

-> Part_ii Server IP address set

-> Part_iii local Mount directory address set

-> Manage the user name and password for part_iv server access

-> 122 testing ..

Nsversion: v7.1.11.31.2013-wed-x86_64

'

Test


Part_ I = 'sudo Mount-T smbfs'


# ------- Part_ii -------

# Servers, // ip/server_folder/

# Server_123 = '// IP1/DC/document/

Server_123 = '// ip2/partner/P1 /'

Server_132 = '// IP3/serom_doc /'

Server_8539 = '// ip4/releaserom /'

Server_20 = '// IP5/DOC $ /'

Server_122 = '// ip6/partner/tool/usbdrive'


# Locates

Server_138 = '// iplocal1 /-_-/'

# Server_73 = '// iplocal1/storage/all_roms_bins /'

Server_73 = '// iplocal1/share /'

# Server_73 = '// iplocal1/storage /'

If [$1 == "138"]; then

Part_ii =$ {server_138}

Elif [$1 = "73"]; then

Part_ii =$ {server_73}

Elif [$1 = "20"]; then

Part_ii =$ {server_20}

Elif [$1 == "8539"]; then

Part_ii =$ {server_8539}

Elif [$1 == "132"]; then

Part_ii =$ {server_132}

Elif [$1 == "123"]; then

Part_ii =$ {server_123}

Elif [$1 == "122"]; then

Part_ii =$ {server_122}

Else

Echo "ip not found..."; exit

Fi


# Locate mount directory

Loc_138 = ~ /Music/liu138

Loc_73 = ~ /Music/73 allbins

Loc_20 = ~ /Music/20doc

Loc_8539 = ~ /Music/8539 share

Loc_132 = ~ /Music/132 releaserom

Loc_123 = ~ /Music/123 liliserom

Loc_122 = ~ /Music/122adb

If [$1 == "138"]; then

Part_iii =$ {loc_138}

Elif [$1 = "73"]; then

Part_iii =$ {loc_73}

Elif [$1 = "20"]; then

Part_iii =$ {loc_20}

Elif [$1 == "8539"]; then

Part_iii =$ {loc_8539}

Elif [$1 == "132"]; then

Part_iii =$ {loc_132}

Elif [$1 == "123"]; then

Part_iii =$ {loc_123}

Elif [$1 == "122"]; then

Part_iii =$ {loc_122}

Else

Echo "ip not found..."; exit

Fi


Function part_iv ()

{

Echo "-O iocharset = utf8, uid =$ {user}, Gid =$ {user}, unmask = 022, username = $1, password = $2"

}


Function echo_mount ()

{

Echo "Start mount: $1 .."

}


Function echo_mount_flag ()

{

Echo "endin mount: $1 done .."

}


Function go ()

{

Echo_mount $ {part_ii}

$ {Part_ I }$ {part_ii }$ {part_iii} $1

# Echo $ {part_ I }$ {part_ii }$ {part_iii} $1

Echo_mount_flag $ {part_ii}

}


If [$1 = "138"]; then # ip138 is not in this management scope

Go 'Part _ IV username password'

Elif [$1 = "20"]; then

Go "'Part _ IV username password '"

Elif [$1 = "73"]; then

Go "'Part _ IV username password '"

Elif [$1 == "123"]; then

Go "'Part _ IV username password '"

Elif [$1 == "132"]; then

Go "'Part _ IV username password '"

Elif [$1 == "8539"]; then

Go "'Part _ IV username password '"

Elif [$1 == "122"]; then

Go "'Part _ IV username password '"

Else

Echo "not support, maybe your input is not correct ."

Fi


This article is from the "andyhdchoice" blog, please be sure to keep this source http://andyhdchoice.blog.51cto.com/1521623/1548802

Example: mount the shared directory of the server to the local Ubuntu directory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.