- Ошибка
-
thread '<unnamed>' panicked at 'Client::new(): Error(DnsSystemConf(Custom { kind: Other, error: StringError("Error parsing resolv.conf: InvalidOption(21)") }))', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
fatal runtime error: failed to initiate panic, error 5
Aborted (core dumped)
Bad work gbd dump
- ОС
- Linux
- Amx Mod X
-
AMX Mod X 1.9.0.5294 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Dec 3 2021 15:54:56
Built from: https://github.com/alliedmodders/amxmodx/commit/363871a
Build ID: 5294:363871a
Core mode: JIT+ASM32
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.12.0.780-dev
Build date: 16:20:56 Sep 19 2022 (3082)
Build from: https://github.com/dreamstalker/rehlds/commit/d6ebe82
- ReGamedll
-
ReGameDLL version: 5.21.0.576-dev
Build date: 08:31:59 Mar 11 2023
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/8ff30b4
- Версия Metamod
-
Metamod-r v1.3.0.131, API (5:13)
Metamod-r build: 18:51:02 Jul 11 2022
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/adc9414
- Список метамодулей
-
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5294 ini Start ANY
[ 2] Reunion RUN - reunion_mm_i386.so v0.1.92d ini Start Never
[ 3] WHBlocker RUN - whblocker_mm_i386.so v1.5.697 ini Chlvl ANY
[ 4] Revoice RUN - revoice_mm_i386.so v0.1.0.34 ini Start Never
[ 5] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 6] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 7] SafeNameAndChat RUN - SafeNameAndChat.so v1.2 Beta 3 ini ANY ANY
[ 8] Fun RUN - fun_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[ 9] Engine RUN - engine_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[10] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[11] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[12] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[13] CSX RUN - csx_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[14] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[15] CSSB RUN - cssb_amxx_i386.so v6-12.12.2020 pl1 ANY ANY
[16] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl1 ANY Never
[17] ReAPI RUN - reapi_amxx_i386.so v5.22.0.254-dev pl1 ANY Never
[18] MySQL RUN - mysql_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[19] ReCSDM RUN - csdm_amxx_i386.so v3.6 pl1 ANY ANY
19 plugins, 19 running
- Список плагинов
-
Currently loaded plugins:
name version author file status
[ 1] Admin Base 1.9.0.5294 AMXX Dev Team admin.amxx running
[ 2] Admin Commands 1.9.0.5294 AMXX Dev Team admincmd.amxx running
[ 3] Admin Help 1.9.0.5294 AMXX Dev Team adminhelp.amxx running
[ 4] Slots Reservation 1.9.0.5294 AMXX Dev Team adminslots.amxx running
[ 5] Multi-Lingual System 1.9.0.5294 AMXX Dev Team multilingual.am running
[ 6] Menus Front-End 1.9.0.5294 AMXX Dev Team menufront.amxx running
[ 7] Commands Menu 1.9.0.5294 AMXX Dev Team cmdmenu.amxx running
[ 8] Players Menu 1.9.0.5294 AMXX Dev Team plmenu.amxx running
[ 9] Maps Menu 1.9.0.5294 AMXX Dev Team mapsmenu.amxx running
[ 10] Plugin Menu 1.9.0.5294 AMXX Dev Team pluginmenu.amxx running
[ 11] Admin Chat 1.9.0.5294 AMXX Dev Team adminchat.amxx running
[ 12] Anti Flood 1.9.0.5294 AMXX Dev Team antiflood.amxx running
[ 13] Scrolling Message 1.9.0.5294 AMXX Dev Team scrollmsg.amxx running
[ 14] Info. Messages 1.9.0.5294 AMXX Dev Team imessage.amxx running
[ 15] Admin Votes 1.9.0.5294 AMXX Dev Team adminvote.amxx running
[ 16] Stats Configuration 1.9.0.5294 AMXX Dev Team statscfg.amxx running
[ 17] UpdateHint 1.3 Lev updatehint.amxx running
[ 18] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 19] Simple Damager 2.1.0 fl0wer simple_damager. debug
[ 20] resetscore(ReAPI) 1.0 Phantom resetscore.amxx debug
[ 21] Lite VoteBan 1.4 neygomon LiteVoteban.amx debug
[ 22] Para & DoubleJ 1.0.0 Nordic Warrior parachute_doubl debug
[ 23] Hook 1.1 AcE hook.amxx debug
[ 24] Accuracy Fix 3.0 Numb accuracy_fix.am debug
[ 25] DM AutoBalance 1.0.0 Nordic Warrior AutoBalance.amx debug
[ 26] Smoke Grenade Modes 0.0.4 Vaqtincha sg_modes_beta_n debug
[ 27] Donate money 0.1 Sanlerus \ di.al donate_money.am debug
[ 28] GameName Changer 1.0 neugomon gamename_change debug
[ 29] Reklama 20.05.2020 mx?! reklama.amxx debug
[ 30] Admin ESP 1.0 neygomon admin_esp.amxx debug
[ 31] Admin Prefixes 3.0 m0skVi4a ;] AdminPrefixes.a debug
[ 32] Night VIPs 1.1.1 szawesome night_vips.amxx debug
[ 33] AFK Control 1.0.3 Emma Jule reapi_afk.amxx debug
[ 34] Ping Control 1.2 mx?! ping_control.am debug
[ 35] Map Manager: Core 3.1.5-79ed Mistrick map_manager_cor running
[ 36] Map Manager: Scheduler 0.2.1-79ed Mistrick map_manager_sch running
[ 37] Map Manager: Rtv 0.1.4-79ed Mistrick map_manager_rtv running
[ 38] Map Manager: BlockList 0.0.4-79ed Mistrick map_manager_blo running
[ 39] Map Manager: Online so 0.0.4-79ed Mistrick map_manager_onl running
[ 40] Map Manager: Effects 0.1.2-79ed Mistrick map_manager_eff running
[ 41] Map Manager: Informer 0.0.5-79ed Mistrick map_manager_inf running
[ 42] Map Manager: Sounds 0.0.3-79ed Mistrick map_manager_sou running
[ 43] Map Manager: Priority 0.0.2-79ed Mistrick map_manager_pri running
[ 44] Map Manager: Online ch 1.0.2-79ed Sergey Shorokhov map_manager_onl running
[ 45] CSSB Shop Menu CSDM 15.10.2018 SMaster cssbShopMenuCSD debug
[ 46] CSSB Open Menu Cmd 01.03.2016 SMaster cssbOpenMenuCmd running
[ 47] CSSB Multi Vampire 15.10.2018 SMaster cssbMultiVampir debug
[ 48] CSSB Destroyer 15.10.2018 SMaster cssbDestroyer.a debug
[ 49] CSSB Goliath Sentry Gu 24.05.2020 SMaster cssbGoliathSent debug
[ 50] CSSB Laser Scanner 15.10.2018 SMaster cssbLaserMinesS debug
[ 51] CSSB Laser Fence 15.10.2018 SMaster cssbLaserFence. debug
[ 52] CSSB Dispenser 15.10.2018 SMaster cssbDispenser.a debug
[ 53] CSSB Tesla Coil 15.10.2018 SMaster cssbTeslaCoil.a debug
[ 54] CSSB Infinite Ammo 17.12.2017 SMaster cssbInfiniteAmm debug
[ 55] CSSB All Grenades 17.12.2017 SMaster cssbAllGrenades debug
[ 56] CSSB AWP Golden Dragon 10.03.2018 SMaster cssbAwpGoldenDr debug
[ 57] CSSB Deagle Golden Dra 10.03.2018 SMaster cssbDeagleGolde debug
[ 58] CSSB Ak47 Golden Drago 10.03.2018 SMaster cssbAk47GoldenD debug
[ 59] CSSB M4A1 Golden Drago 10.03.2018 SMaster cssbM4A1GoldenD debug
[ 60] CSSB Bazooka Gold 11.07.2020 SMaster cssbBazookaGold debug
[ 61] CSSB Mini Gun 10.03.2018 SMaster cssbMiniGun.amx debug
[ 62] CSSB Skills Pump Syste 15.10.2018 SMaster cssbSkillsPumpS running
[ 63] CSSB Skills Pump Healt 05.05.2016 SMaster cssbSkillsPumpH running
[ 64] CSSB Skills Pump Armor 05.05.2016 SMaster cssbSkillsPumpA running
[ 65] CSSB Skills Pump Invis 04.12.2016 SMaster cssbSkillsPumpI running
[ 66] CSSB Skills Pump Speed 04.12.2016 SMaster cssbSkillsPumpS running
[ 67] CSSB Skills Pump Gravi 04.12.2016 SMaster cssbSkillsPumpG running
[ 68] ReCSDM Main 3.6 ReCSDM Team csdm_main.amxx running
[ 69] ReCSDM Equip 3.6 ReCSDM Team csdm_equip.amxx running
[ 70] ReCSDM Spawns 3.6 ReCSDM Team csdm_spawn_pres running
[ 71] ReCSDM Misc 3.6 ReCSDM Team csdm_misc.amxx running
[ 72] ReCSDM Stripper 3.6 KWo csdm_stripper.a running
[ 73] ReCSDM Protection 3.6 BAILOPAN csdm_protection running
73 plugins, 73 running
- Автор плагина
- ex3m777
- Версия плагина
- 1.2.0
- Исходный код
-
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <grip>
#define SLEEP_TIME // закоментируйте если вам не нужен ночной режим, когда сообщения не будут приходить
#if defined SLEEP_TIME
const g_Start_Time = 21 // Время начала ночного режима
const g_End_Time = 09 // Время конца ночного режима
#endif
new const DELAY = 30; // Анти-спам в секундах.
new const g_URL[] = "https://api.telegram.org/botBLA BLA/sendmessage?chat_id=********&text=";
new Float:g_flNextTime[33];
new const LANG_NAME[] = "telegram.txt"
public plugin_init() {
register_plugin("Telegram MSG", "1.2.0", "ex3m777");
register_clcmd("say /tg","message");
register_clcmd("say_team /tg", "message");
register_clcmd("Telegram","CommandMessage");
register_dictionary(LANG_NAME);
}
public HandleRequest() {
new GripResponseState:responseState = grip_get_response_state();
if (responseState == GripResponseStateError) {
return;
}
new GripHTTPStatus:status = grip_get_response_status_code();
if (status != GripHTTPStatusCreated) {
return;
}
}
public message(id) {
#if defined SLEEP_TIME
static CurHour; time(CurHour);
if(g_Start_Time <= CurHour && CurHour < g_End_Time) {
client_print_color(id, print_team_default, "%l %l", "TG_TAG", "TG_SLEEP");
return PLUGIN_HANDLED;
}
#endif
if(g_flNextTime[id] > get_gametime()) {
client_print_color(id, print_team_default, "%l %l", "TG_TAG", "TG_SPAM");
return PLUGIN_HANDLED;
}
client_cmd(id,"messagemode Telegram");
client_print_color(id, print_team_default, "%l %l", "TG_TAG", "TG_ENTER");
g_flNextTime[id] = get_gametime() + DELAY;
return PLUGIN_CONTINUE;
}
public CommandMessage(id) {
new Args[256], text[512]
read_args(Args, charsmax(Args));
remove_quotes(Args);
if(strlen(Args) < 1) {
return;
}
new GripBody:body = grip_body_from_string("{^"title^": ^"foo^", ^"body^": ^"bar^", ^"userId^": 1}");
new GripRequestOptions:options = grip_create_default_options();
grip_options_add_header(options, "Content-Type", "application/json");
grip_options_add_header(options, "User-Agent", "Grip");
formatex(text, charsmax(text), "%s%n: %s", g_URL, id, Args);
grip_request(text, body, GripRequestTypePost, "HandleRequest", options);
grip_destroy_body(body);
grip_destroy_options(options);
client_print_color(id, print_team_default, "%l %l", "TG_TAG", "TG_OK");
static sAuth[25];
get_user_authid(id, sAuth, charsmax(sAuth));
log_to_file("telegram.log", "Игрок [%n] [%s] отправил сообщение: %s", id, sAuth, Args);
}
Добрый день всем! Поставил плагин https://dev-cs.ru/resources/986/. Сервер просто с ним не поднимается. Ошибку указал выше.
С получением нормального дампа не могу разобраться. GDB поставил ulimit -c unlimited прописал. Но при падение не создается нормальный краш дамп с гдб. Просто дает строку запуска. VDS ubuntu 22.4 server. Все маны под дебиан написаны, но к сожалению я настроил на бубне. Может кто сталкивался, помогите пожалуйста разобраться. Плагин на самом деле на втором месте. Больше интересует корректный крашлог. Я так понимаю если нормально запишет краш, будет больше инфы в чем дело.
Файл
С получением нормального дампа не могу разобраться. GDB поставил ulimit -c unlimited прописал. Но при падение не создается нормальный краш дамп с гдб. Просто дает строку запуска. VDS ubuntu 22.4 server. Все маны под дебиан написаны, но к сожалению я настроил на бубне. Может кто сталкивался, помогите пожалуйста разобраться. Плагин на самом деле на втором месте. Больше интересует корректный крашлог. Я так понимаю если нормально запишет краш, будет больше инфы в чем дело.
Файл
#!/bin/sh
#
# Copyright (c) 2002, Valve LLC. All rights reserved.
#
# a wrapper script for the main hl dedicated server binary.
# Performs auto-restarting of the server on crash. You can
# extend this to log crashes and more.
#
# setup the libraries, local dir first!
export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
init() {
# Initialises the various variables
# Set up the defaults
GAME="valve"
DEBUG=1
RESTART="yes"
HL=./hlds_linux
HL_DETECT=1
TIMEOUT=10 # time to wait after a crash (in seconds)
CRASH_DEBUG_MSG="Bad work gbd dump"
GDB="gdb" # the gdb binary to run
DEBUG_LOG="debug.log"
PID_FILE="hlds.21909.pid"
STEAM=""
STEAMERR=""
SIGINT_ACTION="quit 0" # exit normally on sig int
NO_TRAP=0
AUTO_UPDATE=""
BETA_VERSION=""
PARAMS=$*
# Remove any old default pid files
# Cant do this as they may be still running
#rm -f hlds.*.pid
# use the $FORCE environment variable if its set
if test -n "$FORCE" ; then
# Note: command line -binary will override this
HL=$FORCE
HL_DETECT=0
fi
while test $# -gt 0; do
case "$1" in
"-game")
GAME="$2"
shift ;;
"-debug")
DEBUG=1
# Ensure that PID_FILE is set
if test -z "$PID_FILE"; then
PID_FILE="hlds.$$.pid"
fi ;;
"-norestart")
RESTART="" ;;
"-pidfile")
PID_FILE="$2"
shift ;;
"-binary")
HL="$2"
HL_DETECT=0
shift ;;
"-timeout")
TIMEOUT="$2"
shift ;;
"-gdb")
GDB="$2"
shift ;;
"-debuglog")
DEBUG_LOG="$2"
shift ;;
"-autoupdate")
AUTO_UPDATE="yes"
STEAM="steamcmd/steamcmd.sh"
RESTART="yes" ;;
"-steamerr")
STEAMERR=1 ;;
"-ignoresigint")
SIGINT_ACTION="" ;;
"-notrap")
NO_TRAP=1 ;;
"-beta")
BETA_VERSION="$2"
shift ;;
"-help")
# quit with syntax
quit 2
;;
esac
shift
done
# Ensure we have a game specified
if test -z "$GAME"; then
echo "Unable to determine game type from command line."
quit 1
elif test ! -d "$GAME"; then
echo "Invalid game type '$GAME' sepecified."
quit 1
fi
#if test 0 -eq "$NO_TRAP"; then
# Set up the int handler
# N.B. Dont use SIGINT symbolic value
# as its just INT under ksh
#trap "$SIGINT_ACTION" 2
#fi
if test ! -f "$HL"; then
echo "Half-life binary '$HL' not found, exiting"
quit 1
elif test ! -x "$HL"; then
# Could try chmod but dont know what we will be
# chmoding so just fail.
echo "Half-life binary '$HL' not executable, exiting"
quit 1
fi
# Setup debugging
if test "$DEBUG" -eq 1; then
#turn on core dumps :) (if possible)
echo "Enabling debug mode"
if test "
ulimit -c unlimited
fi
GDB_TEST=
if test -z "$GDB_TEST"; then
echo "Please install gdb first."
echo "goto http://www.gnu.org/software/gdb/ "
DEBUG=0 # turn off debugging cause gdb isn't installed
fi
fi
PID_IN_PARAMS="
if test -z "$PID_IN_PARAMS" && test -n "$PID_FILE"; then
HL_CMD="$HL $PARAMS -pidfile $PID_FILE"
else
HL_CMD="$HL $PARAMS"
fi
}
syntax () {
# Prints script syntax
echo "Syntax:"
echo "$0 [-game <game>] [-debug] [-norestart] [-pidfile]"
echo " [-binary [hlds_linux]"
echo " [-timeout <number>] [-gdb <gdb>] [-autoupdate]"
echo " [-steamerr] [-ignoresigint] [-beta <version>]"
echo " [-debuglog <logname>]"
echo "Params:"
echo "-game <game> Specifies the <game> to run."
echo "-debug Run debugging on failed servers if possible."
echo "-debuglog <logname> Log debug output to this file."
echo "-norestart Don't attempt to restart failed servers."
echo "-pidfile <pidfile> Use the specified <pidfile> to store the server pid."
echo "-binary <binary> Use the specified binary ( no auto detection )."
echo "-timeout <number> Sleep for <number> seconds before restarting"
echo " a failed server."
echo "-gdb <gdb> Use <dbg> as the debugger of failed servers."
echo "-steamerr Quit on steam update failure."
echo "-beta <version> Make use of a beta version of this server from Steam"
echo "-ignoresigint Ignore signal INT ( prevents CTRL+C quitting"
echo " the script )."
echo "-notrap Don't use trap. This prevents automatic"
echo " removal of old lock files."
echo ""
echo "Note: All parameters specified as passed through to the server"
echo "including any not listed."
}
debugcore () {
# Debugs any core file if DEBUG is set and
# the exitcode is none 0
exitcode=$1
if test $exitcode -ne 0; then
if test -n "$DEBUG" ; then
echo "bt" > debug.cmds;
echo "info locals" >> debug.cmds;
echo "info sharedlibrary" >> debug.cmds
echo "info frame" >> debug.cmds; # works, but gives an error... must be last
echo "----------------------------------------------" >> $DEBUG_LOG
echo "CRASH:
echo "Start Line: $HL_CMD" >> $DEBUG_LOG
# check to see if a core was dumped
if test -f core ; then
CORE="core"
elif test -f core.
CORE=core.
elif test -f "$HL.core" ; then
CORE="$HL.core"
fi
if test -n "$CORE"; then
$GDB $HL $CORE -x debug.cmds -batch >> $DEBUG_LOG
fi
echo "End of crash report" >> $DEBUG_LOG
echo "----------------------------------------------" >> $DEBUG_LOG
echo $CRASH_DEBUG_MSG
rm debug.cmds
else
echo "Add \"-debug\" to the $0 command line to generate a debug.log to help with solving this problem"
fi
fi
}
update() {
updatesingle
}
updatesingle() {
# Run the steam update
# exits on failure if STEAMERR is set
if test -n "$AUTO_UPDATE"; then
if test -f "$STEAM"; then
echo "Updating server using Steam."
CMD="$STEAM +logon anonymous +force_install_dir .. +app_update 90 +quit";
if test -n "$BETA_VERSION"; then
CMD="$CMD -beta $BETA_VERSION";
fi
STEAMEXE=steamcmd $CMD
if test $? -ne 0; then
if test -n "$STEAMERR"; then
echo "
quit 1
else
echo "
return 0
fi
fi
else
if test -n "$STEAMERR"; then
echo "Could not locate steam binary:$STEAM, exiting.";
quit 1
else
echo "Could not locate steam binary:$STEAM, ignoring.";
return 0
fi
fi
fi
return 1
}
run() {
# Runs the steam update and server
# Loops if RESTART is set
# Debugs if server failure is detected
# Note: if RESTART is not set then
# 1. DEBUG is set then the server is NOT exec'd
# 2. DEBUG is not set the the server is exec'd
if test -n "$RESTART" ; then
echo "Auto-restarting the server on crash"
#loop forever
while true
do
# Update if needed
update
# Run the server
$HL_CMD
retval=$?
if test $retval -eq 0 && test -z "$RESTART" ; then
break; # if 0 is returned then just quit
fi
debugcore $retval
echo "
# don't thrash the hard disk if the server dies, wait a little
sleep $TIMEOUT
done # while true
else
# Update if needed
update
# Run the server
if test "$DEBUG" -eq 0; then
# debug not requested we can exec
exec $HL_CMD
else
# debug requested we can't exec
$HL_CMD
debugcore $?
fi
fi
}
quit() {
# Exits with the give error code, 1
# if none specified.
# exit code 2 also prints syntax
exitcode="$1"
# default to failure
if test -z "$exitcode"; then
exitcode=1
fi
case "$exitcode" in
0)
echo "
2)
syntax ;;
*)
echo "
esac
# Remove pid file
if test -n "$PID_FILE" && test -f "$PID_FILE" ; then
# The specified pid file
rm -f $PID_FILE
fi
# reset SIGINT and then kill ourselves properly
trap - 2
kill -2 $$
}
# Initialise
init $*
# Run
run
# Quit normally
quit 0
#
# Copyright (c) 2002, Valve LLC. All rights reserved.
#
# a wrapper script for the main hl dedicated server binary.
# Performs auto-restarting of the server on crash. You can
# extend this to log crashes and more.
#
# setup the libraries, local dir first!
export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
init() {
# Initialises the various variables
# Set up the defaults
GAME="valve"
DEBUG=1
RESTART="yes"
HL=./hlds_linux
HL_DETECT=1
TIMEOUT=10 # time to wait after a crash (in seconds)
CRASH_DEBUG_MSG="Bad work gbd dump"
GDB="gdb" # the gdb binary to run
DEBUG_LOG="debug.log"
PID_FILE="hlds.21909.pid"
STEAM=""
STEAMERR=""
SIGINT_ACTION="quit 0" # exit normally on sig int
NO_TRAP=0
AUTO_UPDATE=""
BETA_VERSION=""
PARAMS=$*
# Remove any old default pid files
# Cant do this as they may be still running
#rm -f hlds.*.pid
# use the $FORCE environment variable if its set
if test -n "$FORCE" ; then
# Note: command line -binary will override this
HL=$FORCE
HL_DETECT=0
fi
while test $# -gt 0; do
case "$1" in
"-game")
GAME="$2"
shift ;;
"-debug")
DEBUG=1
# Ensure that PID_FILE is set
if test -z "$PID_FILE"; then
PID_FILE="hlds.$$.pid"
fi ;;
"-norestart")
RESTART="" ;;
"-pidfile")
PID_FILE="$2"
shift ;;
"-binary")
HL="$2"
HL_DETECT=0
shift ;;
"-timeout")
TIMEOUT="$2"
shift ;;
"-gdb")
GDB="$2"
shift ;;
"-debuglog")
DEBUG_LOG="$2"
shift ;;
"-autoupdate")
AUTO_UPDATE="yes"
STEAM="steamcmd/steamcmd.sh"
RESTART="yes" ;;
"-steamerr")
STEAMERR=1 ;;
"-ignoresigint")
SIGINT_ACTION="" ;;
"-notrap")
NO_TRAP=1 ;;
"-beta")
BETA_VERSION="$2"
shift ;;
"-help")
# quit with syntax
quit 2
;;
esac
shift
done
# Ensure we have a game specified
if test -z "$GAME"; then
echo "Unable to determine game type from command line."
quit 1
elif test ! -d "$GAME"; then
echo "Invalid game type '$GAME' sepecified."
quit 1
fi
#if test 0 -eq "$NO_TRAP"; then
# Set up the int handler
# N.B. Dont use SIGINT symbolic value
# as its just INT under ksh
#trap "$SIGINT_ACTION" 2
#fi
if test ! -f "$HL"; then
echo "Half-life binary '$HL' not found, exiting"
quit 1
elif test ! -x "$HL"; then
# Could try chmod but dont know what we will be
# chmoding so just fail.
echo "Half-life binary '$HL' not executable, exiting"
quit 1
fi
# Setup debugging
if test "$DEBUG" -eq 1; then
#turn on core dumps :) (if possible)
echo "Enabling debug mode"
if test "
ulimit -c
" -eq 0 ; thenulimit -c unlimited
fi
GDB_TEST=
$GDB -v
if test -z "$GDB_TEST"; then
echo "Please install gdb first."
echo "goto http://www.gnu.org/software/gdb/ "
DEBUG=0 # turn off debugging cause gdb isn't installed
fi
fi
PID_IN_PARAMS="
echo $PARAMS | grep -e -pidfile
"if test -z "$PID_IN_PARAMS" && test -n "$PID_FILE"; then
HL_CMD="$HL $PARAMS -pidfile $PID_FILE"
else
HL_CMD="$HL $PARAMS"
fi
}
syntax () {
# Prints script syntax
echo "Syntax:"
echo "$0 [-game <game>] [-debug] [-norestart] [-pidfile]"
echo " [-binary [hlds_linux]"
echo " [-timeout <number>] [-gdb <gdb>] [-autoupdate]"
echo " [-steamerr] [-ignoresigint] [-beta <version>]"
echo " [-debuglog <logname>]"
echo "Params:"
echo "-game <game> Specifies the <game> to run."
echo "-debug Run debugging on failed servers if possible."
echo "-debuglog <logname> Log debug output to this file."
echo "-norestart Don't attempt to restart failed servers."
echo "-pidfile <pidfile> Use the specified <pidfile> to store the server pid."
echo "-binary <binary> Use the specified binary ( no auto detection )."
echo "-timeout <number> Sleep for <number> seconds before restarting"
echo " a failed server."
echo "-gdb <gdb> Use <dbg> as the debugger of failed servers."
echo "-steamerr Quit on steam update failure."
echo "-beta <version> Make use of a beta version of this server from Steam"
echo "-ignoresigint Ignore signal INT ( prevents CTRL+C quitting"
echo " the script )."
echo "-notrap Don't use trap. This prevents automatic"
echo " removal of old lock files."
echo ""
echo "Note: All parameters specified as passed through to the server"
echo "including any not listed."
}
debugcore () {
# Debugs any core file if DEBUG is set and
# the exitcode is none 0
exitcode=$1
if test $exitcode -ne 0; then
if test -n "$DEBUG" ; then
echo "bt" > debug.cmds;
echo "info locals" >> debug.cmds;
echo "info sharedlibrary" >> debug.cmds
echo "info frame" >> debug.cmds; # works, but gives an error... must be last
echo "----------------------------------------------" >> $DEBUG_LOG
echo "CRASH:
date
" >> $DEBUG_LOGecho "Start Line: $HL_CMD" >> $DEBUG_LOG
# check to see if a core was dumped
if test -f core ; then
CORE="core"
elif test -f core.
cat $PID_FILE
; thenCORE=core.
cat $PID_FILE
elif test -f "$HL.core" ; then
CORE="$HL.core"
fi
if test -n "$CORE"; then
$GDB $HL $CORE -x debug.cmds -batch >> $DEBUG_LOG
fi
echo "End of crash report" >> $DEBUG_LOG
echo "----------------------------------------------" >> $DEBUG_LOG
echo $CRASH_DEBUG_MSG
rm debug.cmds
else
echo "Add \"-debug\" to the $0 command line to generate a debug.log to help with solving this problem"
fi
fi
}
update() {
updatesingle
}
updatesingle() {
# Run the steam update
# exits on failure if STEAMERR is set
if test -n "$AUTO_UPDATE"; then
if test -f "$STEAM"; then
echo "Updating server using Steam."
CMD="$STEAM +logon anonymous +force_install_dir .. +app_update 90 +quit";
if test -n "$BETA_VERSION"; then
CMD="$CMD -beta $BETA_VERSION";
fi
STEAMEXE=steamcmd $CMD
if test $? -ne 0; then
if test -n "$STEAMERR"; then
echo "
date
: Steam Update failed, exiting."quit 1
else
echo "
date
: Steam Update failed, ignoring."return 0
fi
fi
else
if test -n "$STEAMERR"; then
echo "Could not locate steam binary:$STEAM, exiting.";
quit 1
else
echo "Could not locate steam binary:$STEAM, ignoring.";
return 0
fi
fi
fi
return 1
}
run() {
# Runs the steam update and server
# Loops if RESTART is set
# Debugs if server failure is detected
# Note: if RESTART is not set then
# 1. DEBUG is set then the server is NOT exec'd
# 2. DEBUG is not set the the server is exec'd
if test -n "$RESTART" ; then
echo "Auto-restarting the server on crash"
#loop forever
while true
do
# Update if needed
update
# Run the server
$HL_CMD
retval=$?
if test $retval -eq 0 && test -z "$RESTART" ; then
break; # if 0 is returned then just quit
fi
debugcore $retval
echo "
date
: Server restart in $TIMEOUT seconds"# don't thrash the hard disk if the server dies, wait a little
sleep $TIMEOUT
done # while true
else
# Update if needed
update
# Run the server
if test "$DEBUG" -eq 0; then
# debug not requested we can exec
exec $HL_CMD
else
# debug requested we can't exec
$HL_CMD
debugcore $?
fi
fi
}
quit() {
# Exits with the give error code, 1
# if none specified.
# exit code 2 also prints syntax
exitcode="$1"
# default to failure
if test -z "$exitcode"; then
exitcode=1
fi
case "$exitcode" in
0)
echo "
date
: Server Quit" ;;2)
syntax ;;
*)
echo "
date
: Server Failed" ;;esac
# Remove pid file
if test -n "$PID_FILE" && test -f "$PID_FILE" ; then
# The specified pid file
rm -f $PID_FILE
fi
# reset SIGINT and then kill ourselves properly
trap - 2
kill -2 $$
}
# Initialise
init $*
# Run
run
# Quit normally
quit 0