Jump to content

Making a "script" to be run on SSH

Recommended Posts


When you're going to open a MTA server in a VPS/Dedicated Server, you must put a sequence of commands,

I was wondering if it is possible to make some kind of script do do this automatically, I was googling it but I can't find any helpful link. The closest thing I found was setting up a 'script' to be run at the startup of the server.

Do you know how to do this? I am almost sure that hosting company owners know it.

Any help is really appreciated,


Link to comment

Well, this is my summary.

1. Make 'bin' directory at 'home' directory.

Move via cd to that directory.

NOTE: This isn't really nessesary.

Just place the script into the folder you wish to install your server(s). i.e root

2. Before giving the script a name, we must check that it doesn't exist by doing:

which [command]

3. Open nano editor, and begin writting the script:



# My first script

echo "Hello World!"

4. Give it permissions to use the command (ONLY WITH CURRENT USER)

chmod u+x my_script

If you wish to remove permission, use:

chmod u-x my_script

Source: http://www.seas.upenn.edu/cets/answers/chmod.html

5. To execute the script type:


It's actually way easier than you can ever imagine

Link to comment
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...