Jump to content
  • 0

how to implement auto server restart


darking123

Question


  • Group:  Members
  • Topic Count:  318
  • Topics Per Day:  0.07
  • Content Count:  931
  • Reputation:   13
  • Joined:  12/20/11
  • Last Seen:  

i am using the code below and save it as auto-restarter.sh

then i put it to my /home/testro

then what will be the next step?

#!/bin/bash
run=1
if [ "$run" -eq 1 ]; then
if [ $(ps | grep -e login-server | wc -l) -eq 0 ]; then
# Login server down
./login-server_sql & > /dev/null
fi
if [ $(ps | grep -e char-server | wc -l) -eq 0 ]; then
# Char server down
./char-server_sql & > /dev/null
fi
if [ $(ps | grep -e map-server | wc -l) -eq 0 ]; then
# Map server down
./map-server_sql & > /dev/null
fi
sleep 10
./auto-restarter.sh &
fi

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  63
  • Reputation:   3
  • Joined:  07/12/12
  • Last Seen:  

Surprised nobody answered this one!

1. Put that file auto-restarter.sh in your rathena folder.

2. make sure you chmod so you don't get any permission errors when running it

3. make sure your server is off with ./athena-start stop and then use ./auto-restarter.sh to run your server.

If the login/char/map server every fail and go offline, it will automatically boot that server back up for you.

The main thing here is when you start the server, don't use ./athena-start start, but use ./auto-restarter.sh

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  139
  • Reputation:   2
  • Joined:  07/05/12
  • Last Seen:  

eh.. this script is good :D but how to stop it O_O?

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.

Guest
Answer this question...

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

×
×
  • Create New...