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 Server майже рік, і повірте мені, це дуже чутливий і помилками сервера в обслуговуванні. Buggy in the sense that it crashes nearly everyday especially when you are running intensive mods such as ZombieMod or Garry's Mod. Багги в тому сенсі, що він виходить з ладу майже кожен день особливо якщо ви працюєте в інтенсивному моди таких, як моделювання або ZombieMod Garry's. 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. Це нелегко і займає багато часу для налагодження і з'ясувати, що є причиною катастрофи. 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 на Linux, сервер саме по собі вже підтримує функцію автоматичного перезапуску 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 і відразу Auto запускає командного рядка, якщо він не працює. 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. Я знайшов перезавантаження Crash, яка працює відмінно з тих пір я почав використовувати його. Restart on Crash is an monitoring tool that will watch the applications that you specify and automatically relaunch any program that hangs or crashes. Перезавантаження збоїв є інструментом контролю, що буде дивитися програми, які ви вказуєте і автоматично відновити будь-яку програму, яка зависає або аварій. 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. Перша команда показує, що я Ping 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 Завантажити перезавантаження Crash ] ]

Technorati Tags: Бірки Technorati: , , , , , , , ,