yarka0000 1
yarka0000
kralhakan2009 1
kralhakan2009
Vahsi Uzman 1
Vahsi Uzman
farkmt2official 1
farkmt2official
Hikaye Ekle

Panel Scripti [Başlat,Kapat,Yedek,Quest Okutma,Syser Temizliği]

  • Konuyu başlatan Konuyu başlatan Murat K.
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 15
  • Görüntüleme Görüntüleme 1K
5.00 yıldız(lar) 5 Değerlendirme Değerlendirenler

Ayyıldız2 | 2008 TR Yapısı • 1-99 Orta Emek Destan • Oto Avsız • 10 Temmuz 21:00 HEMEN TIKLA!

Kendinize göre düzenleyin.

Server Başlat
Server Kapat
Yedek Al
Quest Okutma
Syser Temizliği

Gibi fonksiyonlar bulunmaktadır.

Bana ait değildir başka bir yerden cukkaladım. :)


[CODE title="panel.sh"]import os
import subprocess
import time

TO_DELETE = ["syserr", "syslog", "cartof.core", "db.core"]
CORE_NAME = "cartof"
BACKUP_PATH = "/usr/game/backup"
SERVER_PATH = "/usr/game/server/"
LOCALE_SERVICE_QUESTS = "/usr/game/share/locale/romania/quest"

def main():
print('''
\033[1;32;40m___________ __ __
\_ _____/______ ____ ____/ \ / \_____ _______
| __) \_ __ \_/ __ \_/ __ \ \/\/ /\__ \\_ __ \
| \ | | \/\ ___/\ ___/\ / / __ \| | \/
\___ / |__| \___ >\___ >\__/\__/ (____ /__|
\/ \/ \/ \/ \/
__________ .__
\______ \_____ ____ ____ | |
| ___/\__ \ / \_/ __ \| |
| | / __ \| | \ ___/| |__
|____| (____ /___| /\___ >____/
\/ \/ \/
Press Key:
1) Start Server
2) Close Server
3) Clean SYSERR, SYSLOG, CoreDump
4) Compile all or one quest
5) Backup Server
0) Close
\033[0;37;40m
''')

while True:
a = raw_input("Value between 0 and 5:")
try:
a = int(a)
except ValueError:
print "Valid number, please"
continue
if 0 <= a <= 5:
break
else:
print "Valid range, please: 0-5"

if a == 1:
print("\033[1;36;40mPlease enter number of CH(1-4): \033[0;37;40m")
while True:
chn = raw_input("Digit 0 to break start operation! ")
try:
chn = int(chn)
except ValueError:
print "Valid number, please"
continue
if 0 <= chn <= 4:
break
else:
print "Valid range, please: 0-4"


if chn == 0:
return
os.chdir(SERVER_PATH + "db_auth/db")
subprocess.Popen("./db")
time.sleep(2)
os.chdir(SERVER_PATH + "db_auth/auth")
subprocess.Popen("./auth")
time.sleep(2)
for x in range(1, (chn + 1)):
folderlink = (SERVER_PATH + "ch" + str(chn))
for y in range(1, 5):
os.chdir(folderlink + "/core_" + str(y))
subprocess.Popen("./core_" + str(y))
time.sleep(2)

print("\033[1;32;40m ++Server Online++ \033[0;37;40m")
return

elif a == 2:
Alive = ""
ps = subprocess.Popen("pgrep " + CORE_NAME, shell=True, stdout=subprocess.PIPE)
Alive = ps.stdout.read()
ps.stdout.close()
ps.wait()
if len(Alive) > 0:
subprocess.Popen("pkill " + CORE_NAME, shell=True, stdout=subprocess.PIPE)
print("Metin2 server closed!")

elif len(Alive) == 0:
print("Metin2 Server is already Offline!")
return

elif a == 3:
for x in range(0, len(TO_DELETE)):
print "Deleting " + TO_DELETE[x]
ps = subprocess.Popen("find . -name " + TO_DELETE[x] + " -delete", shell=True, stdout=subprocess.PIPE)
print("Clean!1")

elif a == 4:
print("Digit the name of the quest or digit 'ALL' to compile all quests: ")
name = raw_input()
os.chdir(LOCALE_SERVICE_QUESTS)
if name == "ALL":
os.system("for f in *.quest; do ./qc $f; done")
os.system("for f in *.lua; do ./qc $f; done")
else:
os.system("./qc " + name)

elif a == 5:
from datetime import datetime
Time = str(datetime.now())
print "Backup on the way..."
if not os.path.exists(BACKUP_PATH):
os.makedirs(BACKUP_PATH)
os.chdir(BACKUP_PATH)
os.makedirs(Time)
os.chdir(Time)
os.system("tar cfzv GAME_" + Time + ".tar.gz /usr/game")
os.system("tar cfzv MySQL_" + Time +".tar.gz /var/db/mysql")


elif a == 0:
os.system("clear")
return


time.sleep(1)
main()

main()[/CODE]
[/CENTER]
 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst