I have been managing a Counter-Strike: Source server for nearly a year and believe me, it is a very sensitive and buggy server to maintain. הייתי בניהול Counter-Strike: Source שרת קרוב לשנה ותאמין לי, הוא שרת מאוד רגישה כדי לשמור על העגלה. Buggy in the sense that it crashes nearly everyday especially when you are running intensive mods such as ZombieMod or Garry's Mod. Buggy במובן זה אותו קורס כמעט יומיומי במיוחד כאשר אתה מפעיל mods אינטנסיבית כגון ZombieMod או Garry's Mod. Moreover there are hundreds of third party plugins for SourceMod and EventScripts which makes it even more unstable because of incompatibility problems. בנוסף ישנם מאות תוספים צד שלישי עבור SourceMod ו EventScripts מה שהופך אותו אפילו יותר יציב בגלל בעיות תאימות. It is not easy and time consuming to debug and find out what is causing the crash. זה לא קל וצריכה זמן debug ולגלות מה הגורם להתרסקות. So it is important to be able to auto restart the server when the srcds crashes. לכן חשוב להיות מסוגל להפעיל מחדש את השרת אוטומטי כאשר srcds קריסות.

If you are running a CSS server on linux, the server itself already supports auto restarting srcds when crash. אם אתה מפעיל שרת לינוקס ב-CSS, השרת עצמו כבר תומכת אוטומטית מחדש כאשר srcds לקרוס. However on Windows, you can do it via a batch file. עם זאת ב-Windows, אתה יכול לעשות זאת באמצעות קובץ אצווה. It works but it has its problems in doing that which I'll explain further. זה עובד אבל יש לו בעיות שלה עושה את אשר אני אסביר יותר.

This is the batch file that you need to run to keep srcds.exe open by automatically running when crashed or closed. זהו קובץ האצווה אתה צריך לרוץ כדי לשמור srcds.exe פתוח על ידי הפועלים באופן אוטומטי כאשר התרסק או סגור.

@echo off
cls
echo Protecting srcds from crashes...
echo If you want to close srcds and this script, close the srcds window and type Y depending on your language followed by Enter.
title srcds.com Watchdog
:srcds
echo (%time%) srcds started.
start /wait srcds.exe -console -game cstrike +map de_dust +maxplayers 16
echo (%time%) WARNING: srcds closed or crashed, restarting.
goto srcds

The command above will monitor for srcds.exe and immediately auto runs the command line if it's not running. הפקודה לעיל תפקח על srcds.exe ומיד מפעילה אוטומטית את שורת הפקודה אם זה לא פועל. Well Valve recommends that we should wait for at least 10 seconds before restarting so that there is enough time for the memory to clear up. ובכן Valve ממליצה אנחנו צריכים לחכות 10 שניות לפחות לפני אתחול, כך שיש מספיק זמן בזיכרון לנקות. I've used this batch and noticed that there were a few times the server crashes, restart, crashes again and restart. השתמשתי אצווה ושמתי לב היו כמה פעמים הקריסות של השרת, הפעלה מחדש, מתרסק שוב מחדש. Previously I've written an בעבר כתבתי article מאמר that contains a couple of free tools that can auto rerun program when closed but this time I needed something different. שמכיל כמה כלים בחינם שיכולים תוכנית בשידור חוזר אוטומטי כאשר נסגר אבל הפעם אני צריכה משהו אחר.

I was looking for a free, small, simple and portable tool that can monitor for a specific process and then run a “different” file when it detects a crash. אני מחפש כלי חינם, קטן, פשוט נייד יכול לפקח על תהליך מסוים ולאחר מכן להפעיל את קובץ "אחר" כאשר הוא מגלה התרסקות. I found Restart on Crash which has been working perfectly ever since I started using it. מצאתי מחדש על קראש אשר עובדת לחלוטין מאז שהתחלתי להשתמש בו. Restart on Crash is an monitoring tool that will watch the applications that you specify and automatically relaunch any program that hangs or crashes. הפעל מחדש על קראש הוא כלי ניטור כי יצפו יישומים שתציין באופן אוטומטי relaunch כל תוכנית נתקע או מתרסק. You can add any number of applications to monitor, enable/disable them individually and edit the command line that will be used to restart an application. אתה יכול להוסיף מספר יישומים כדי לפקח, להפעיל או לבטל אותם בנפרד ולערוך את שורת הפקודה אשר ישמשו כדי להפעיל מחדש יישום. Restart on Crash doesn't require installation and stores all it's configuration data in a “settings.ini” file in the program's folder, so it's portable. הפעל מחדש על קראש אינה דורשת התקנה וחנויות כל זה נתוני תצורה settings.ini "" הקובץ בתיקייה של התוכנית, כך שזה נייד. It should be compatible with most NT-based Windows versions. זה צריך להיות תואם NT רוב גירסאות מבוססות-Windows.

Basically the below image is the settings for the srcds server. בעיקרון מתחת התמונה ההגדרות של שרת srcds. It monitors srcds.exe and when it isn't running, a run.bat file will be executed. זה צגים srcds.exe וכאשר זה אינו פועל, קובץ run.bat יבוצע.
הפעל מחדש על קראש

The more interesting part is the run.bat which is executed when the program detected that srcds.exe is not running. החלק המעניין יותר הוא run.bat אשר מופעל בעת תוכנית זיהה כי srcds.exe אינו פועל. Since it is a batch file, I can program it to run multiple commands. מאז היא קובץ אצווה, אני יכולה התוכנית זה כדי להפעיל פקודות מרובות.
הפעלת התוכנית לאחר ההתרסקות
The first command shows that I ping localhost 3 times. הפקודה הראשונה מראה כי אני פינג localhost 3 פעמים. This command is being used as a feature to wait for 3 seconds before going to the second command. פקודה זו משמשת תכונה לחכות 3 שניות לפני שאני הולכת הפקודה השנייה. The second command from the batch file is to execute הפקודה השנייה מן קובץ האצווה היא לבצע CleanMem CleanMem which is a tool to clean process and file cache to recover even more memory and performance. אשר הוא כלי לנקות את קובץ המטמון ואת תהליך לשחזר זיכרון אפילו יותר ביצועים. Then again pause for 10 seconds before running srcds.exe with the full command line. ואז שוב הפסקה במשך 10 שניות לפני הפעלת srcds.exe עם שורת הפקודה מלא. This method has been working perfectly for weeks already and I didn't need any other more advanced crash recovery software such as Firedaemon that cost money. שיטה זו עובדת היטב במשך שבועות ואני כבר לא צריך שום תוכנות אחרות מתקדמות יותר כגון התאוששות מנפילות Firedaemon כי עולות כסף.

[ [ Download Restart on Crash להוריד מחדש על קראש ] ]

Technorati Tags: Technorati Tags: , , , , , , , ,