Jump to content

Create mounting script


Recommended Posts

I have just been tasked with mounting a folder from numerous workstations onto the server so that the info in there can be backed up to tape. I know the commands that I wish for this. I am new to scripting in linux and wonder how I would make this an executable script.

 

Example:

I would like to be able to run a command/script called PCMOUNT which would then execute the following:

 

smbmount //laptop/archive /home/archive/laptop rw

smbmount //pc1/archive /home/archive/pc1 rw

smbmount //pc2/archive /home/archive/pc2 rw

 

Also, I would want to be able to create a script that would unmount them.

 

Long story short, how would I make the file an executable?

Link to comment
Share on other sites

Put the commands in a file and put at the top of the file

 

#!<path to your favorite shell>

 

so for example

 

#!/bin/bash

 

Make the file executable and call it like an executable file .... The commands will be executed by the the command-interpreter (I believe) (here a shell) you specified.

 

I think this is all. I'm not a big expert in this, so others could add some stuff :).

Edited by Michel
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...