* Removed unnecessary getlogincount.pl, mapcheck.sh and mapchecker.sh tools (topic:262934).
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14693 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
8dc5d7029c
commit
6cbc16833f
@ -1,5 +1,7 @@
|
||||
Date Added
|
||||
|
||||
2011/02/05
|
||||
* Removed unnecessary getlogincount.pl, mapcheck.sh and mapchecker.sh tools (topic:262934). [Ai4rei]
|
||||
2011/02/02
|
||||
* Fixed non-windows 'findfile' utils function missing a 'closedir' call (bugreport:4739, since r1629). [Ai4rei]
|
||||
2011/01/31
|
||||
|
@ -1,122 +0,0 @@
|
||||
#!/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;
|
||||
};
|
@ -1,34 +0,0 @@
|
||||
#!/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
|
@ -1,56 +0,0 @@
|
||||
#!/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
|
Loading…
x
Reference in New Issue
Block a user