diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-02-06 00:08:50 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-02-06 00:08:50 +0000 |
commit | 138dc7f32a3c64cc87bf83d4ac9d1bc83036e49b (patch) | |
tree | 5b294f407d9a7ee6a05d478ea2c855ae2fb901fd /tools | |
parent | 55a1afff4320314cd4b40a6f0b36d3a0f57b9c68 (diff) | |
download | hercules-138dc7f32a3c64cc87bf83d4ac9d1bc83036e49b.tar.gz hercules-138dc7f32a3c64cc87bf83d4ac9d1bc83036e49b.tar.bz2 hercules-138dc7f32a3c64cc87bf83d4ac9d1bc83036e49b.tar.xz hercules-138dc7f32a3c64cc87bf83d4ac9d1bc83036e49b.zip |
* Removed unnecessary getlogincount.pl, mapcheck.sh and mapchecker.sh tools (topic:262934).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14693 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/getlogincount.pl | 122 | ||||
-rwxr-xr-x | tools/mapcheck.sh | 34 | ||||
-rwxr-xr-x | tools/mapchecker.sh | 56 |
3 files changed, 0 insertions, 212 deletions
diff --git a/tools/getlogincount.pl b/tools/getlogincount.pl deleted file mode 100755 index de075ed22..000000000 --- a/tools/getlogincount.pl +++ /dev/null @@ -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; -}; diff --git a/tools/mapcheck.sh b/tools/mapcheck.sh deleted file mode 100755 index 337884c43..000000000 --- a/tools/mapcheck.sh +++ /dev/null @@ -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
\ No newline at end of file diff --git a/tools/mapchecker.sh b/tools/mapchecker.sh deleted file mode 100755 index 7250c342e..000000000 --- a/tools/mapchecker.sh +++ /dev/null @@ -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 |