summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorbrianluau <brianluau@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-07-27 16:56:26 +0000
committerbrianluau <brianluau@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-07-27 16:56:26 +0000
commita269c22b8d92b56a6b09bc2fa8375d1803cab909 (patch)
tree758a3a283bbfe847cdfde9cd3416f55270fb6844 /tools
parentfc079afd18a8189b8542bc4ec989dc4f123e30a7 (diff)
downloadhercules-a269c22b8d92b56a6b09bc2fa8375d1803cab909.tar.gz
hercules-a269c22b8d92b56a6b09bc2fa8375d1803cab909.tar.bz2
hercules-a269c22b8d92b56a6b09bc2fa8375d1803cab909.tar.xz
hercules-a269c22b8d92b56a6b09bc2fa8375d1803cab909.zip
- Added svn:eol-style native for some conf/css/html/pl/sql/txt files.
- Added svn:executable property for several batch/shell scripts. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13972 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'tools')
-rwxr-xr-x[-rw-r--r--]tools/backup.pl (renamed from tools/backup)200
-rwxr-xr-x[-rw-r--r--]tools/checkversion.pl (renamed from tools/checkversion)170
-rwxr-xr-x[-rw-r--r--]tools/getlogincount.pl (renamed from tools/getlogincount)244
-rwxr-xr-x[-rw-r--r--]tools/mapcheck.sh66
-rwxr-xr-x[-rw-r--r--]tools/mapchecker.sh112
5 files changed, 396 insertions, 396 deletions
diff --git a/tools/backup b/tools/backup.pl
index 2b5a95814..939c7eee7 100644..100755
--- a/tools/backup
+++ b/tools/backup.pl
@@ -1,100 +1,100 @@
-#!/usr/bin/perl
-
-##########################################################################
-# Athena用データバックアップツール
-#
-#  Athenaの各種データファイル*.txtをバックアップするツール
-#
-#-------------------------------------------------------------------------
-# 設定方法
-#  実行する時のカレントフォルダからのデータへのパス、ファイルのリストを
-#  正しく設定します。バックアップ先のフォルダは自動作成されないので、
-#  自分で作成しておく必要があります。
-#  フォルダの最後の「/」は省略できません。
-#
-#  フォルダは引数でも指定できます。例>./backup ../save/ ./backup_data/
-#  フォルダの最後の「/」は省略できません。
-#
-#  実行するとバックアップ先のフォルダへ、ファイル名に現在の日付と時刻を
-#  つけてファイルをコピーします。
-#
-# * toolフォルダ内にbackup_dataフォルダを作成し、
-#   athena.shの中に「./tool/backup ./save/ ./tool/backup_data/」
-# という行を追加すると、athenaを起動するたびにバックアップが取れます
-#
-# 復元するときは引数に「-r 日付と時刻」を指定します。
-#  またその後ろにフォルダを指定することも出来ます
-#  例1> ./backup -r 200309191607
-#  例2> ./backup -r 200309191607 ../save ./backup_data/
-#  この例では2003/09/19の16:07分にバックアップしたデータを復元しています
-#
-#  復元するとき、Athenaディレクトリにあるデータは *.bak に名前を変更して
-#  残しているので、いらない場合は rm *.bak などで消してください。
-#
-##########################################################################
-
-$sdir="../save/"; #バックアップ元(Athenaのディレクトリ/save/)
-$tdir="./backup_data/"; #バックアップ先
-
-@files=( #ファイルのリスト
- "account","athena","storage","party","guild","castle","pet"
-);
-
-
-#-------------------------------設定ここまで-----------------------------
-
-
-
-
-
-
-
-
-
-
-
-if($ARGV[0]=~/^\-r$/i || $ARGV[0]=~/\-\-(recover|restore)/i){
- #復元処理
-
- $file=$ARGV[1];
- $sdir=$ARGV[2]||$sdir;
- $tdir=$ARGV[3]||$tdir;
- &restorecopy($_) foreach @files;
- exit(0);
-}
-
-#バックアップ処理
-$sdir=$ARGV[0]||$sdir;
-$tdir=$ARGV[1]||$tdir;
-
-unless( -d $tdir ){
- print "$0: \"$tdir\" : No such directory\n";
- exit(1);
-}
-
-(undef,$min,$hour,$day,$month,$year)=localtime;
-
-$file=sprintf("%04d%02d%02d%02d%02d",
- $year+1900, $month+1, $day, $hour, $min );
-
-&backupcopy($_) foreach @files;
-exit(0);
-
-sub backupcopy {
- my($name)= @_;
- system("cp $sdir$name.txt $tdir$name$file.txt");
-}
-
-sub restorecopy {
- my($name)= @_;
- unless( -f "$sdir$name.txt" ){
- printf("$0: \"$sdir$name.txt\" not found!\n");
- return 0;
- }
- unless( -f "$tdir$name$file.txt" ){
- printf("$0: \"$tdir$name$file.txt\" not found!\n");
- return 0;
- }
- rename "$sdir$name.txt","$sdir$name.bak";
- system("cp $tdir$name$file.txt $sdir$name.txt");
-}
+#!/usr/bin/perl
+
+##########################################################################
+# Athena用データバックアップツール
+#
+#  Athenaの各種データファイル*.txtをバックアップするツール
+#
+#-------------------------------------------------------------------------
+# 設定方法
+#  実行する時のカレントフォルダからのデータへのパス、ファイルのリストを
+#  正しく設定します。バックアップ先のフォルダは自動作成されないので、
+#  自分で作成しておく必要があります。
+#  フォルダの最後の「/」は省略できません。
+#
+#  フォルダは引数でも指定できます。例>./backup ../save/ ./backup_data/
+#  フォルダの最後の「/」は省略できません。
+#
+#  実行するとバックアップ先のフォルダへ、ファイル名に現在の日付と時刻を
+#  つけてファイルをコピーします。
+#
+# * toolフォルダ内にbackup_dataフォルダを作成し、
+#   athena.shの中に「./tool/backup ./save/ ./tool/backup_data/」
+# という行を追加すると、athenaを起動するたびにバックアップが取れます
+#
+# 復元するときは引数に「-r 日付と時刻」を指定します。
+#  またその後ろにフォルダを指定することも出来ます
+#  例1> ./backup -r 200309191607
+#  例2> ./backup -r 200309191607 ../save ./backup_data/
+#  この例では2003/09/19の16:07分にバックアップしたデータを復元しています
+#
+#  復元するとき、Athenaディレクトリにあるデータは *.bak に名前を変更して
+#  残しているので、いらない場合は rm *.bak などで消してください。
+#
+##########################################################################
+
+$sdir="../save/"; #バックアップ元(Athenaのディレクトリ/save/)
+$tdir="./backup_data/"; #バックアップ先
+
+@files=( #ファイルのリスト
+ "account","athena","storage","party","guild","castle","pet"
+);
+
+
+#-------------------------------設定ここまで-----------------------------
+
+
+
+
+
+
+
+
+
+
+
+if($ARGV[0]=~/^\-r$/i || $ARGV[0]=~/\-\-(recover|restore)/i){
+ #復元処理
+
+ $file=$ARGV[1];
+ $sdir=$ARGV[2]||$sdir;
+ $tdir=$ARGV[3]||$tdir;
+ &restorecopy($_) foreach @files;
+ exit(0);
+}
+
+#バックアップ処理
+$sdir=$ARGV[0]||$sdir;
+$tdir=$ARGV[1]||$tdir;
+
+unless( -d $tdir ){
+ print "$0: \"$tdir\" : No such directory\n";
+ exit(1);
+}
+
+(undef,$min,$hour,$day,$month,$year)=localtime;
+
+$file=sprintf("%04d%02d%02d%02d%02d",
+ $year+1900, $month+1, $day, $hour, $min );
+
+&backupcopy($_) foreach @files;
+exit(0);
+
+sub backupcopy {
+ my($name)= @_;
+ system("cp $sdir$name.txt $tdir$name$file.txt");
+}
+
+sub restorecopy {
+ my($name)= @_;
+ unless( -f "$sdir$name.txt" ){
+ printf("$0: \"$sdir$name.txt\" not found!\n");
+ return 0;
+ }
+ unless( -f "$tdir$name$file.txt" ){
+ printf("$0: \"$tdir$name$file.txt\" not found!\n");
+ return 0;
+ }
+ rename "$sdir$name.txt","$sdir$name.bak";
+ system("cp $tdir$name$file.txt $sdir$name.txt");
+}
diff --git a/tools/checkversion b/tools/checkversion.pl
index 135165236..e13b7370c 100644..100755
--- a/tools/checkversion
+++ b/tools/checkversion.pl
@@ -1,85 +1,85 @@
-#!/usr/bin/perl -w
-
-##########################################################################
-# INFORMATION TOOL ABOUT THE SERVERS VERSION OF ATHENA
-#
-# By connection on a server, this software display the version of the
-# designed server.
-#-------------------------------------------------------------------------
-# Usages:
-# ./checkversion IP:port
-# ./checkversion IP port
-# perl checkversion IP:port
-# perl checkversion IP port
-#
-# note: default port: 6900
-#
-# When successfull, the software return the value 0.
-#
-##########################################################################
-
-#------------------------- start of configuration ------------------------
-
-$connecttimeout = 10; # Connection Timeout (in seconds)
-
-#-------------------------- End of configuration -------------------------
-
-use IO::Socket;
-
-unless($ARGV[0]) {
- print "USAGE: $0 server_ip:port\n";
- exit(1);
-}
-
-$server = $ARGV[0];
-$port = $ARGV[1];
-$port = $1 if ($server =~ s/:(\d+)//);
-$port ||= 6900;
-
-# Connection to the server
-my($so,$er) = ();
-eval{
- $so = IO::Socket::INET->new(
- PeerAddr=> $server,
- PeerPort=> $port,
- Proto => "tcp",
- Timeout => $connecttimeout) or $er = 1;
-};
-
-if($er || $@) {
- print "Can't not connect to server [$server:$port] !\n";
- exit(2);
-}
-
-# Request for the server version
-print $so pack("v",30000); # 0x7530
-$so->flush();
-
-# Receiving of the answer of the server
-if (read($so,$buf,10) < 10) {
- print "Invalid answer. It isn't an athena server or it is a too old version.\n";
- exit(5);
-}
-
-# Sending end of connection to the server
-print $so pack("v",30002); # 0x7532
-$so->flush();
-
-# Analyse of the answer
-my($ret,$maver,$miver,$rev,$dev,$mod,$type,$mdver) = unpack("v c6 v",$buf);
-
-if ($ret != 30001) { # 0x7531
- print "Invalid answer. It isn't an athena server or it is a too old version.\n";
- exit(6);
-}
-
-my(@stype) = ();
-foreach $i(0..3) {
- push @stype,(("login","char","inter","map")[$i]) if( $type & (1<<$i) );
-}
-print " ".join("/",@stype)." server [$server:$port].\n";
-printf " Athena version %s-%d.%d", ("stable","dev")[$dev], $maver,$miver;
-printf " revision %d",$rev if $rev;
-printf "%s%d\n",("","-mod")[$mod],$mdver;
-
-exit(0);
+#!/usr/bin/perl -w
+
+##########################################################################
+# INFORMATION TOOL ABOUT THE SERVERS VERSION OF ATHENA
+#
+# By connection on a server, this software display the version of the
+# designed server.
+#-------------------------------------------------------------------------
+# Usages:
+# ./checkversion.pl IP:port
+# ./checkversion.pl IP port
+# perl checkversion.pl IP:port
+# perl checkversion.pl IP port
+#
+# note: default port: 6900
+#
+# When successfull, the software return the value 0.
+#
+##########################################################################
+
+#------------------------- start of configuration ------------------------
+
+$connecttimeout = 10; # Connection Timeout (in seconds)
+
+#-------------------------- End of configuration -------------------------
+
+use IO::Socket;
+
+unless($ARGV[0]) {
+ print "USAGE: $0 server_ip:port\n";
+ exit(1);
+}
+
+$server = $ARGV[0];
+$port = $ARGV[1];
+$port = $1 if ($server =~ s/:(\d+)//);
+$port ||= 6900;
+
+# Connection to the server
+my($so,$er) = ();
+eval{
+ $so = IO::Socket::INET->new(
+ PeerAddr=> $server,
+ PeerPort=> $port,
+ Proto => "tcp",
+ Timeout => $connecttimeout) or $er = 1;
+};
+
+if($er || $@) {
+ print "Can't not connect to server [$server:$port] !\n";
+ exit(2);
+}
+
+# Request for the server version
+print $so pack("v",30000); # 0x7530
+$so->flush();
+
+# Receiving of the answer of the server
+if (read($so,$buf,10) < 10) {
+ print "Invalid answer. It isn't an athena server or it is a too old version.\n";
+ exit(5);
+}
+
+# Sending end of connection to the server
+print $so pack("v",30002); # 0x7532
+$so->flush();
+
+# Analyse of the answer
+my($ret,$maver,$miver,$rev,$dev,$mod,$type,$mdver) = unpack("v c6 v",$buf);
+
+if ($ret != 30001) { # 0x7531
+ print "Invalid answer. It isn't an athena server or it is a too old version.\n";
+ exit(6);
+}
+
+my(@stype) = ();
+foreach $i(0..3) {
+ push @stype,(("login","char","inter","map")[$i]) if( $type & (1<<$i) );
+}
+print " ".join("/",@stype)." server [$server:$port].\n";
+printf " Athena version %s-%d.%d", ("stable","dev")[$dev], $maver,$miver;
+printf " revision %d",$rev if $rev;
+printf "%s%d\n",("","-mod")[$mod],$mdver;
+
+exit(0);
diff --git a/tools/getlogincount b/tools/getlogincount.pl
index 6a209924f..de075ed22 100644..100755
--- a/tools/getlogincount
+++ b/tools/getlogincount.pl
@@ -1,122 +1,122 @@
-#!/usr/bin/perl -w
-
-##########################################################################
-# INFORMATION TOOL ABOUT THE # OF ONLINE PLAYERS ON ATHENA SERVERS
-#
-# By connection on the athena login-server, this software displays the
-# number of online players.
-#
-#-------------------------------------------------------------------------
-# Software usage:
-# Configure the IP, the port and a valid account of the server.
-# After, use at your choice:
-# ./getlogincount - display the number of online players on all servers.
-# ./getlogincount --premier or
-# ./getlogincount --first -- display the number of online players of the
-# first server in the received list.
-# ./getlogincount [servername] -- display the number of online players
-# of the specified server.
-#
-# If successfull, the software return the value 0.
-#
-##########################################################################
-
-#------------------------------ CONFIGURATION ----------------------------
-
-$loginserverip = "127.0.0.1"; # IP of the login-server
-$loginserverport = 6900; # port of the login-server
-$loginaccount = "s1"; # a valid account name
-$loginpasswd = "p1"; # the password of the valid account name
-
-$connecttimeout = 10; # Connection timeout (in seconds)
-
-#-------------------------------------------------------------------------
-
-use IO::Socket;
-
-my($sname) = $ARGV[0];
-if (!defined($sname)) {
- $sname = "";
-}
-
-# Connection to the login-server
-my($so,$er) = ();
-eval{
- $so = IO::Socket::INET->new(
- PeerAddr=> $loginserverip,
- PeerPort=> $loginserverport,
- Proto => "tcp",
- Timeout => $connecttimeout) or $er=1;
-};
-if($er || $@){
- print "Can't not connect to the login-server [${loginserverip}:$loginserverport] !\n";
- exit(2);
-}
-
-# Request to connect on login-server
-print $so pack("v V a24 a24 C",0x0064,9,$loginaccount,$loginpasswd,3);
-$so->flush();
-
-# Fail to connect
-if(unpack("v", &soread(\$so,2)) != 0x0069) {
- print "Login error.\n";
- exit(3);
-}
-
-# Get length of the received packet
-my($plen) = unpack("v",&soread(\$so,2))-4;
-
-# Suppress information of the account (we need only information about the servers)
-&soread(\$so,43);
-$plen -= 43;
-
-# Check about the number of online servers
-if ($plen < 32) {
- printf "No server is connected to login-server.\n";
- exit(1);
-}
-
-# Read information of the servers
-my(@slist) = ();
-for(;$plen > 0;$plen -= 32) {
- my($name,$count) = unpack("x6 a20 V",&soread(\$so,32));
- $name = substr($name,0,index($name,"\0"));
- push @slist, [ $name, $count ];
-}
-
-# Display the result
-if($sname eq "--first" || $sname eq "--premier") { # If we ask only for the first server
- printf "%-20s : %5d\n",$slist[0][0],$slist[0][1];
-} elsif ($sname eq "") { # If we ask for all servers
- foreach $i(@slist) {
- printf "%-20s : %5d\n",$i->[0],$i->[1];
- }
-} else { # If we ask for a specified server (by its name)
- my($flag) = 1;
- foreach $i(@slist) {
- if($i->[0] eq $sname) {
- printf "%-20s : %5d\n",$i->[0],$i->[1];
- $flag = 0;
- }
- }
- if($flag) { # If the server doesn't exist
- printf "The server [$sname] doesn't exist.\n";
- exit(1);
- }
-}
-
-# End of the software
-$so->shutdown(2);
-$so->close();
-exit(0);
-
-# Sub-function: get data from the socket
-sub soread {
- my($so,$len) = @_;
- my($sobuf);
- if(read($$so,$sobuf,$len) < $len) {
- print "Socket read error.\n";
- exit(5);
- }
- return $sobuf;
-};
+#!/usr/bin/perl -w
+
+##########################################################################
+# INFORMATION TOOL ABOUT THE # OF ONLINE PLAYERS ON ATHENA SERVERS
+#
+# By connection on the athena login-server, this software displays the
+# number of online players.
+#
+#-------------------------------------------------------------------------
+# Software usage:
+# Configure the IP, the port and a valid account of the server.
+# After, use at your choice:
+# ./getlogincount.pl - display the number of online players on all servers.
+# ./getlogincount.pl --premier or
+# ./getlogincount.pl --first -- display the number of online players of the
+# first server in the received list.
+# ./getlogincount.pl [servername] -- display the number of online players
+# of the specified server.
+#
+# If successfull, the software return the value 0.
+#
+##########################################################################
+
+#------------------------------ CONFIGURATION ----------------------------
+
+$loginserverip = "127.0.0.1"; # IP of the login-server
+$loginserverport = 6900; # port of the login-server
+$loginaccount = "s1"; # a valid account name
+$loginpasswd = "p1"; # the password of the valid account name
+
+$connecttimeout = 10; # Connection timeout (in seconds)
+
+#-------------------------------------------------------------------------
+
+use IO::Socket;
+
+my($sname) = $ARGV[0];
+if (!defined($sname)) {
+ $sname = "";
+}
+
+# Connection to the login-server
+my($so,$er) = ();
+eval{
+ $so = IO::Socket::INET->new(
+ PeerAddr=> $loginserverip,
+ PeerPort=> $loginserverport,
+ Proto => "tcp",
+ Timeout => $connecttimeout) or $er=1;
+};
+if($er || $@){
+ print "Can't not connect to the login-server [${loginserverip}:$loginserverport] !\n";
+ exit(2);
+}
+
+# Request to connect on login-server
+print $so pack("v V a24 a24 C",0x0064,9,$loginaccount,$loginpasswd,3);
+$so->flush();
+
+# Fail to connect
+if(unpack("v", &soread(\$so,2)) != 0x0069) {
+ print "Login error.\n";
+ exit(3);
+}
+
+# Get length of the received packet
+my($plen) = unpack("v",&soread(\$so,2))-4;
+
+# Suppress information of the account (we need only information about the servers)
+&soread(\$so,43);
+$plen -= 43;
+
+# Check about the number of online servers
+if ($plen < 32) {
+ printf "No server is connected to login-server.\n";
+ exit(1);
+}
+
+# Read information of the servers
+my(@slist) = ();
+for(;$plen > 0;$plen -= 32) {
+ my($name,$count) = unpack("x6 a20 V",&soread(\$so,32));
+ $name = substr($name,0,index($name,"\0"));
+ push @slist, [ $name, $count ];
+}
+
+# Display the result
+if($sname eq "--first" || $sname eq "--premier") { # If we ask only for the first server
+ printf "%-20s : %5d\n",$slist[0][0],$slist[0][1];
+} elsif ($sname eq "") { # If we ask for all servers
+ foreach $i(@slist) {
+ printf "%-20s : %5d\n",$i->[0],$i->[1];
+ }
+} else { # If we ask for a specified server (by its name)
+ my($flag) = 1;
+ foreach $i(@slist) {
+ if($i->[0] eq $sname) {
+ printf "%-20s : %5d\n",$i->[0],$i->[1];
+ $flag = 0;
+ }
+ }
+ if($flag) { # If the server doesn't exist
+ printf "The server [$sname] doesn't exist.\n";
+ exit(1);
+ }
+}
+
+# End of the software
+$so->shutdown(2);
+$so->close();
+exit(0);
+
+# Sub-function: get data from the socket
+sub soread {
+ my($so,$len) = @_;
+ my($sobuf);
+ if(read($$so,$sobuf,$len) < $len) {
+ print "Socket read error.\n";
+ exit(5);
+ }
+ return $sobuf;
+};
diff --git a/tools/mapcheck.sh b/tools/mapcheck.sh
index 54cdd0765..337884c43 100644..100755
--- a/tools/mapcheck.sh
+++ b/tools/mapcheck.sh
@@ -1,34 +1,34 @@
-#!/bin/sh
-echo "============================================"
-echo "= map server status checker... ="
-echo "============================================"
-./map-server.exe &
-sleep 40
-
-while [ 0 ]
-do
- pcpu=` top -n 1| grep map-server | awk '{print $9}' | awk 'BEGIN{FS="."} {print $1}' `
- if [ "$pcpu" -gt 80 ];then
- echo "============================================"
- echo "map server is more than 80% (now $pcpu%)"
- echo "============================================"
- ppid=` ps -a | grep map-server | awk '{print $1}' `
- kill $ppid
- ./map-server.exe &
- sleep 40
- else
- pmapct=` ps -a| grep map-server | wc -l `
- if [ "$pmapct" -eq 0 ];then
- echo "============================================"
- echo "map server is not running..."
- echo "restart map server..."
- echo "============================================"
- ./map-server.exe &
- sleep 40
- #echo "test"
- else
- echo "map server is ok (now $pcpu%)..."
- sleep 5
- fi
- fi
+#!/bin/sh
+echo "============================================"
+echo "= map server status checker... ="
+echo "============================================"
+./map-server.exe &
+sleep 40
+
+while [ 0 ]
+do
+ pcpu=` top -n 1| grep map-server | awk '{print $9}' | awk 'BEGIN{FS="."} {print $1}' `
+ if [ "$pcpu" -gt 80 ];then
+ echo "============================================"
+ echo "map server is more than 80% (now $pcpu%)"
+ echo "============================================"
+ ppid=` ps -a | grep map-server | awk '{print $1}' `
+ kill $ppid
+ ./map-server.exe &
+ sleep 40
+ else
+ pmapct=` ps -a| grep map-server | wc -l `
+ if [ "$pmapct" -eq 0 ];then
+ echo "============================================"
+ echo "map server is not running..."
+ echo "restart map server..."
+ echo "============================================"
+ ./map-server.exe &
+ sleep 40
+ #echo "test"
+ else
+ echo "map server is ok (now $pcpu%)..."
+ sleep 5
+ fi
+ fi
done \ No newline at end of file
diff --git a/tools/mapchecker.sh b/tools/mapchecker.sh
index 5f26c9d4b..7250c342e 100644..100755
--- a/tools/mapchecker.sh
+++ b/tools/mapchecker.sh
@@ -1,56 +1,56 @@
-#!/bin/bash
-
-athena_dir="/home/athena/658/"
-
-while [ true ] ; do
-
-if [ ` ps fauxw | grep map-server | grep -v grep | wc -l ` -eq 0 ];then
- #echo `date` " -- map-server crashed - restarting"
- echo `date` " -- map-server crashed - restarting" >> /var/log/athena_status.log
- killall -9 map-server
- cd $athena_dir
- nohup ./map-server ./conf/map_athena.conf ./inter_athena.conf &
- sleep 240
- #sleep 40 #for fast pc's remove the "#" at the beginning of the line and delete the line above
-fi
-
-
-if [ ` ps fauxw | grep map-server | grep -v grep | awk '{print $3}' | awk 'BEGIN{FS="."} {print $1}' ` -gt 10 ];then
- #echo `date` " -- mapserver cpuload over 10 - restarting"
- echo `date` " -- mapserver cpuload over 10 - restarting" >> /var/log/athena_status.log
- killall -9 map-server
- cd $athena_dir
- nohup ./map-server ./conf/map_athena.conf ./inter_athena.conf &
- sleep 240
- #sleep 40 #for fast pc's remove the "#" at the beginning of the line and delete the line above
- #echo `date` " -- restarted"
- echo `date` " -- restarted" >> /var/log/athena_status.log
-fi
-
-if [ ` ps fauxw | grep char-server | grep -v grep | wc -l ` -eq 0 ];then
- #echo `date` " -- char server crashed - restarting"
- echo `date` " -- char server crashed - restarting" >> /var/log/athena_status.log
- killall -9 char-server
- cd $athena_dir
- nohup ./char-server ./conf/char_athena.conf ./conf/inter_athena.conf &
- #echo `date` " -- restarted"
- echo `date` " -- restarted" >> /var/log/athena_status.log
-
-fi
-
-if [ ` ps fauxw | grep login-server | grep -v grep | wc -l ` -eq 0 ];then
- #echo `date` " -- login server crashed - restarting"
- echo `date` " -- login server crashed - restarting" >> /var/log/athena_status.log
- killall -9 login-server
- cd $athena_dir
- nohup ./login-server ./conf/login_athena.conf &
- #echo `date` " -- restarted"
- echo `date` " -- restarted" >> /var/log/athena_status.log
-
-fi
-
-
-#echo `date` " -- everything is fine"
-echo `date` " -- everything is fine" >> /var/log/athena_status.log
-sleep 30
-done
+#!/bin/bash
+
+athena_dir="/home/athena/658/"
+
+while [ true ] ; do
+
+if [ ` ps fauxw | grep map-server | grep -v grep | wc -l ` -eq 0 ];then
+ #echo `date` " -- map-server crashed - restarting"
+ echo `date` " -- map-server crashed - restarting" >> /var/log/athena_status.log
+ killall -9 map-server
+ cd $athena_dir
+ nohup ./map-server ./conf/map_athena.conf ./inter_athena.conf &
+ sleep 240
+ #sleep 40 #for fast pc's remove the "#" at the beginning of the line and delete the line above
+fi
+
+
+if [ ` ps fauxw | grep map-server | grep -v grep | awk '{print $3}' | awk 'BEGIN{FS="."} {print $1}' ` -gt 10 ];then
+ #echo `date` " -- mapserver cpuload over 10 - restarting"
+ echo `date` " -- mapserver cpuload over 10 - restarting" >> /var/log/athena_status.log
+ killall -9 map-server
+ cd $athena_dir
+ nohup ./map-server ./conf/map_athena.conf ./inter_athena.conf &
+ sleep 240
+ #sleep 40 #for fast pc's remove the "#" at the beginning of the line and delete the line above
+ #echo `date` " -- restarted"
+ echo `date` " -- restarted" >> /var/log/athena_status.log
+fi
+
+if [ ` ps fauxw | grep char-server | grep -v grep | wc -l ` -eq 0 ];then
+ #echo `date` " -- char server crashed - restarting"
+ echo `date` " -- char server crashed - restarting" >> /var/log/athena_status.log
+ killall -9 char-server
+ cd $athena_dir
+ nohup ./char-server ./conf/char_athena.conf ./conf/inter_athena.conf &
+ #echo `date` " -- restarted"
+ echo `date` " -- restarted" >> /var/log/athena_status.log
+
+fi
+
+if [ ` ps fauxw | grep login-server | grep -v grep | wc -l ` -eq 0 ];then
+ #echo `date` " -- login server crashed - restarting"
+ echo `date` " -- login server crashed - restarting" >> /var/log/athena_status.log
+ killall -9 login-server
+ cd $athena_dir
+ nohup ./login-server ./conf/login_athena.conf &
+ #echo `date` " -- restarted"
+ echo `date` " -- restarted" >> /var/log/athena_status.log
+
+fi
+
+
+#echo `date` " -- everything is fine"
+echo `date` " -- everything is fine" >> /var/log/athena_status.log
+sleep 30
+done