Martyz Posted March 19, 2011 Share Posted March 19, 2011 Hey, anyone has some script for VPS debian 5.0, which would automatically turn on mta-server when it's off..? Please give it to me, I really need it.. :\ Link to comment
Discord Moderators Zango Posted March 23, 2011 Discord Moderators Share Posted March 23, 2011 you can script a cron job to check for process existance every 10 seconds or so, and boot if needed read more about shell scripting Link to comment
Strika Posted March 24, 2011 Share Posted March 24, 2011 First you make a .sh script called mtawatch.sh (or whatever you like) nano mtawatch.sh then paste the code in there #!/bin/sh mta="/home/mtaserver/" process=`ps uxw | grep mta-server | grep -v grep | awk '{print $11}'` if [ -z "$process" ]; then echo "Couldn't find MTA running, restarting it." cd "$mta" screen -A -m -d -S mta ./mta-server echo "Server Started" fi Edit it to your directories and stuff.. Then on the user your running mta server as, type crontab -e In a new line, put this code * * * * * /home/scripts/mtawatch.sh Again, change it to your directories.. also don't forget to chmod +x mtawatch.sh This script will check if the server is running every minute (minimum time for crontab), and it will start it if it isn't running. 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