Jump to content

Some Scripts


Recommended Posts

  • VIP

M2 Download Center

Hidden Content

    Give reaction to this post to see the hidden content.
( Internal )

hello, come here let some scripts that I have been collecting over time...

 

Some were developed by me and others kept some server files.

 

Status:

#!/bin/sh
kk=$(netstat -nlp udp | grep -w 13000 | wc -l) 
if [ $kk = 1 ]
then
	echo -e "033[32m n on033[0m"
else
	echo -e "033[33m n off033[0m" >> syslogg
 	/metin2/live/canal1_1/game &	
	echo -e "033[32m n on Novamente033[0m" >> syslogg
fi

Status2:

#!/bin/sh
cd
php script/status.php

Status2, php script:

<?PHP
include ("ip.php");
$portlist=array(3306);
$i="0";
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "mysqld: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "mysqld: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
$portlist=array(22);
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "sshd: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "sshd: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
$portlist=array(15001);
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "db: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "db: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
$portlist=array(11002);
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "auth: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "auth: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
$portlist=array(13000);
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "channel1_1: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "channel1_1: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
$portlist=array(13001);
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "channel1_2: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "channel1_2: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
$portlist=array(16000);
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "channel2_1: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "channel2_1: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
$portlist=array(16001);
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "channel2_2: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "channel2_2: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
$portlist=array(19000);
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "channel3_1: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "channel3_1: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
$portlist=array(19001);
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "channel3_2: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "channel3_2: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
$portlist=array(22000);
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "channel4_1: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "channel4_1: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
$portlist=array(22001);
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "channel4_2: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "channel4_2: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
$portlist=array(13099);
foreach  ($portlist as $port){
 $online = @fsockopen($ip, $port, $errno, $errstr, 1);
 if (!$online)
 {
  echo "channel99_1: 033[31mDesligado033[0mn";
  $onliner[$i] = "0";
 }
 else
 {
  echo "channel99_1: 033[32mLigado033[0mn";
  $onliner[$i] = "1";
 }
 @fclose($online);
$i++;
}
?>

optimizar db:

#!/bin/sh
mysqlcheck -uroot -ppassword --auto-repair --optimize account
mysqlcheck -uroot -ppassword --auto-repair --optimize common
mysqlcheck -uroot -ppassword --auto-repair --optimize log
mysqlcheck -uroot -ppassword --auto-repair --optimize metin2_runup
mysqlcheck -uroot -ppassword --auto-repair --optimize mysql
mysqlcheck -uroot -ppassword --auto-repair --optimize player
mysqlcheck -uroot -ppassword --auto-repair --optimize website

reset metin2 user permissions:

#!/bin/sh
if [ $USER = root ]; then
chmod -fR 755 /metin2
chown -fR metin2:metin2 /metin2
echo "As permições para o utilizador metin2 foram redefinidas."
else
echo "Só é possível utilizar o comando no utilizador root."
fi

game update:

#!/bin/sh

clear
echo -e "033[31m  
Game Updaten 
sv1
1 - (1) Simn 
2 - (2) Nao033[0m"

read chs

case $chs in 
1*) 
	rm /metin2/bin/game
	fetch http://127.0.0.0/dls/game
	chmod 777 /metin2/bin/game
	echo -e "033[31m n Update Realizado.033[0m"
;;
2*)
		echo -e "033[31m n Cancelado...033[0m"
	sleep 1
	exit
;;

esac

Shutdown:

#!/bin/sh
if [ $USER = root ]; then
shutdown -p now
else
echo "Só é possível utilizar o comando no utilizador root."
fi

Blockip:

#!/bin/sh

# Define aqui o endereço IP a bloquear
IP=0.0.0.0

# Comando para bloquear o acesso ao endereço IP defenido
if [ $USER = root ]; then
if [ $IP = 0.0.0.0 ]; then
echo "Erro: Não editaste o endereço IP. Faz o seguinte comando:"
echo "ee /bin/blockip"
echo "E edita o endereço IP a bloquear."
else
ipfw add deny ip from $IP to any
echo "O endereço IP $IP foi bloqueado."
fi
else
echo "Só é possível utilizar o comando no utilizador root."
fi

backup:

#!/bin/sh
echo "Os logs vao ser apagados..."
rm -f */*/syserr && rm -f */*/syslog && rm -f */*/PTS && rm -f */*/game.core && rm -f */*/quest_mysql.core
rm -f */syserr && rm -f */syslog && rm -f */PTS && rm -f */game.core && rm -f */quest_mysql.core
echo "Logs apagados!"
cd /mt2/backups
mkdir `date +%d.%m.%Y_%H.%m`
cd `date +%d.%m.%Y_%H.%m`
sleep 2
tar cfzv game.tar.gz /metin2/live
sleep 2
tar cfzv mysql.tar.gz /var/db/mysql
sleep 2

echo "Copia Realizada."

I hope you give way  :)

  • Love 3
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.