Jump to content

How To " Auto reStart " ?


3NAD

Recommended Posts

Yeah it's fairly easy

On Linux: login to putty, type crontab -e

This opens your crontab editor. Press I button to start editing. Then type:

*/5 * * * * YOUR_LINUX_USERNAME /path/to/mta-server  

The */5 means every five minutes, execute the specified command.

Then press ESC and then type zz, this means save and exit the editor.

This will start your server every 5 minutes and since MTA server exits when the port is already in use, you don't have to worry about checking if the servers already running manually.

EDIT: Please see following posts on why you should use a script instead of mta-server directly

(Source: http://www.cyberciti.biz/faq/how-do-i-a ... -unix-oses)

On a Windows server, the same can be achieved using the Task Scheduler.

Edited by Guest
Link to comment
Yeah it's fairly easy

On Linux: login to putty, type crontab -e

This opens your crontab editor. Press I button to start editing. Then type:

*/5 * * * * YOUR_LINUX_USERNAME /path/to/mta-server  

The */5 means every five minutes, execute the specified command.

Then press ESC and then type zz, this means save and exit the editor.

This will start your server every 5 minutes and since MTA server exits when the port is already in use, you don't have to worry about checking if the servers already running manually.

(Source: http://www.cyberciti.biz/faq/how-do-i-a ... -unix-oses)

On a Windows server, the same can be achieved using the Task Scheduler.

hmmm.. Thanks for your reply

but If it restart every 5 minutes.

i will lose my visitors =/

Link to comment
Yeah it's fairly easy

On Linux: login to putty, type crontab -e

This opens your crontab editor. Press I button to start editing. Then type:

*/5 * * * * YOUR_LINUX_USERNAME /path/to/mta-server  

The */5 means every five minutes, execute the specified command.

Then press ESC and then type zz, this means save and exit the editor.

This will start your server every 5 minutes and since MTA server exits when the port is already in use, you don't have to worry about checking if the servers already running manually.

(Source: http://www.cyberciti.biz/faq/how-do-i-a ... -unix-oses)

On a Windows server, the same can be achieved using the Task Scheduler.

It will start lots of processes.

You should add a shell script to crontab and that shell script will check whether it is opened or not.

Link to comment
Yeah it's fairly easy

On Linux: login to putty, type crontab -e

This opens your crontab editor. Press I button to start editing. Then type:

*/5 * * * * YOUR_LINUX_USERNAME /path/to/mta-server  

The */5 means every five minutes, execute the specified command.

Then press ESC and then type zz, this means save and exit the editor.

This will start your server every 5 minutes and since MTA server exits when the port is already in use, you don't have to worry about checking if the servers already running manually.

(Source: http://www.cyberciti.biz/faq/how-do-i-a ... -unix-oses)

On a Windows server, the same can be achieved using the Task Scheduler.

It will start lots of processes.

You should add a shell script to crontab and that shell script will check whether it is opened or not.

How to add a shell script?

Link to comment

Mr S3d, if you already created a shell script that does what Anderl suggested (check if the server is running and if not, start the server), then you can edit your crontab with my steps but instead of running mta-server directly, use the .sh script file. That would be the best solution.

I think it'd be a good idea if you posted your shell script here for us to check if it's in order.

I'm now not so sure mta-server really terminates when it can't be bound to a port, since it still prompts to press Q. I guess eventually the remaining few kilobytes will add up and still end up hogging the memory.

Edited by Guest
Link to comment
Yeah it's fairly easy

On Linux: login to putty, type crontab -e

This opens your crontab editor. Press I button to start editing. Then type:

*/5 * * * * YOUR_LINUX_USERNAME /path/to/mta-server  

The */5 means every five minutes, execute the specified command.

Then press ESC and then type zz, this means save and exit the editor.

This will start your server every 5 minutes and since MTA server exits when the port is already in use, you don't have to worry about checking if the servers already running manually.

(Source: http://www.cyberciti.biz/faq/how-do-i-a ... -unix-oses)

On a Windows server, the same can be achieved using the Task Scheduler.

sorry but , from your source how could i use @reboot

i mean after i wrote crontab -e

it's let me edit the file , then i should go under the line # right?

and then write like this

@reboot /home/startup.sh

but how to save the file from putty ?

and the startup.sh file is like that is it okay ?

./home/sora/mta-server 

Link to comment
  • 1 month later...

Currently I'm hosting about 10 MTA servers on linux, and experience tells me that the MTA servers can be crashed by DDoSing the http port.

That means: Normally the MTA servers keep running (and running and running) for ages, but once you attack the http port, sudden crash.

Normally once the MTA server crashes, its completely gone. That means you can check if its running

  
local array=( $(pidof $mainfolder$currID$subfolder"mta-server") ); 
            if [ ${#array[@]} -ne 1 ]; then 
                echo "starting server "$currID; 
                stopup; 
                startup; 
            fi 
  

If its not running, it means it crashed.

Now, about the port:

If MTA cannot initialize the server doe to ANY reason (.so missing, port wrong, mtaserver.conf, acl.xml) it keeps running with the message "press Q to shut down the server".

Link to comment

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...