3NAD Posted November 18, 2012 Share Posted November 18, 2012 Hi , How to create a Auto restart Server on my VPS ?? because The Server Some times, Closing with no reason =/ And thank you # Link to comment
Quited Posted November 18, 2012 Share Posted November 18, 2012 you cant only if you put codes on you server (mtaserver.conf Link to comment
3NAD Posted November 18, 2012 Author Share Posted November 18, 2012 ???? i think i should use Control Panel Link to comment
MR.S3D Posted November 18, 2012 Share Posted November 18, 2012 Hi ,How to create a Auto restart Server on my VPS ?? because The Server Some times, Closing with no reason =/ And thank you # +1 Link to comment
Anderl Posted November 18, 2012 Share Posted November 18, 2012 Yes, you can do that. Create a shell script to check whether server process is closed or opened and start server if closed. Then add it to crontab. Link to comment
3NAD Posted November 18, 2012 Author Share Posted November 18, 2012 Yes, you can do that.Create a shell script to check whether server process is closed or opened and start server if closed. Then add it to crontab. hmm... i didn't understand your steps can you make Explanation ? Link to comment
Anderl Posted November 18, 2012 Share Posted November 18, 2012 1. Create a shell script: http://en.wikipedia.org/wiki/Shell_script 2. Add it to crontab: http://en.wikipedia.org/wiki/Cron 3. Enjoy. Link to comment
Cadu12 Posted November 19, 2012 Share Posted November 19, 2012 MTA has already auto-start resources when you start server. Link to comment
MR.S3D Posted November 19, 2012 Share Posted November 19, 2012 MTA has already auto-start resources when you start server. Not resources He Need to know How make auto restart Server on vps! Link to comment
uhm Posted November 19, 2012 Share Posted November 19, 2012 (edited) 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 November 23, 2012 by Guest Link to comment
3NAD Posted November 19, 2012 Author Share Posted November 19, 2012 Yeah it's fairly easyOn 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
Anderl Posted November 19, 2012 Share Posted November 19, 2012 Yeah it's fairly easyOn 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
MR.S3D Posted November 19, 2012 Share Posted November 19, 2012 Yeah it's fairly easyOn 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
Anderl Posted November 19, 2012 Share Posted November 19, 2012 Instead of running mta-server in crontab, run the shell script? Use the brain, that's what it is for. Link to comment
uhm Posted November 19, 2012 Share Posted November 19, 2012 (edited) 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 November 19, 2012 by Guest Link to comment
Anderl Posted November 19, 2012 Share Posted November 19, 2012 You do, even if the server doesn't start it will keep opening more and more mta-server processes and one time RAM will go. Link to comment
3NAD Posted November 23, 2012 Author Share Posted November 23, 2012 Thank You All , It's Good now ^^ Link to comment
Sora Posted November 23, 2012 Share Posted November 23, 2012 Yeah it's fairly easyOn 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
TAPL Posted November 23, 2012 Share Posted November 23, 2012 https://forum.multitheftauto.com/viewtopic.php?f=106&t=32403 Link to comment
Sora Posted November 23, 2012 Share Posted November 23, 2012 https://forum.multitheftauto.com/viewtopic.php?f=106&t=32403 thanks but i meant @reboot when system starts , the mta server start auto Link to comment
Anderl Posted November 23, 2012 Share Posted November 23, 2012 What system are you using? Btw, use chkconfig to add a service and then just add it to startup programs. Link to comment
Sora Posted November 23, 2012 Share Posted November 23, 2012 What system are you using?Btw, use chkconfig to add a service and then just add it to startup programs. Debian 6.0 32bit Link to comment
Phat Looser Posted December 27, 2012 Share Posted December 27, 2012 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now