LINUX.ORG.RU

ошибка при запуске игрового сервера


0

1

Всем привет. Был раньше на другой vds там сервера все нормально запускались решил перейти на другой где 3 ядерный, т.к вот при запуске пишет это

taskset: failed to get pid 31254's affinity: No such process
renice: failed to get priority for 31254 (process ID): No such process

а вот строчка на счет ядер

usecore="2"  #Привязка к ядрам (0, 1, 2, 3)
А вот сам скрипт запуска
#!/bin/bash
# authors: Puma http://c-s.net.ua
# version: 1.2
#. /lib/lsb/init-functions

#####################################################
# Configuration
#####################################################

server_name="name"  #Название сервера
screen_name="turma"  #Название screen-сессии
use_user="root"  #Имя юзера от которого запускается сервер
path="/var/www/servera/data/jail/11720"  #Путь до ROOT-директории сервера (без /в конце)
hlds_ip="ip"  #IP сервера ,не ставить 0.0.0.0
hlds_port="27015"  #Порт сервера
hlds_players="32"  #Максимальное количество игроков на сервере
hlds_map="jail_czone"  #Имя первоначальной карты при запуске
hlds_options="-debug -pingboost 2 -sys_ticrate 500 -secure"  #Дополнительные параметры запуска
priority="0"  #Приоритет для сервера (-20 - Высокий ;20 - Низкий)
usecore="3"  #Привязка к ядрам (0, 1, 2, 3)
hlds_pid="${screen_name}.pid"  #Имя pid файла сервера
clear_logs="0"  # очишать лог файлы при запуске сервера через скрипт?
clear_cache="0"  # очишать кэши системы перед запуском сервера? # работает только под рутом

checker_cmd="/bin/qstat" #Команда пакета qStat отвечающего за проверку сервера

#####################################################
# End of configuration
#####################################################

if [ ! -x $path/hlds_run ]; then
	printf "${title}${txtred} Set permissions 777 for hlds_run\n"
	chmod -R 777 $path
fi

if [ $use_user == "root" ]; then
	start1=""
else
	start1="sudo -u ${use_user}"
fi

txtwht='\e[0;37m' # White
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtred='\e[0;31m' # Red
title="${txtwht}[${txtgrn}${hlds_ip}:${hlds_port}${txtwht}]"

# check screen pid: ps -ef | grep SCREEN | grep ${screen_name} | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | awk '{print $2}'
# check hlds pid: ps -ef | grep hlds_ | grep -v hlds_run | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | awk '{print $2}'

start() {
	if [ "`ps -ef | grep SCREEN | grep $screen_name | grep $hlds_ip | grep $hlds_port | grep -v grep | wc -l`" -gt 0 ]; then
		if [ "`ps -ef | grep hlds_ | grep -v hlds_run | grep $hlds_ip | grep $hlds_port | grep -v grep | wc -l`" -gt 0 ]; then
			printf "${title} Server ${server_name} already started\n"
			exit 1
		fi
	fi
	cd ${path}
	if [ ${clear_logs} == 1 ]; then
		${start1} rm -f ${path}/debug.log
		${start1} rm -f ${path}/cstrike/qconsole.log
		${start1} rm -fr ${path}/cstrike/logs/*.log
		${start1} rm -fr ${path}/cstrike/addons/amxmodx/logs/*.log
		printf "${title} Server logs cleared\n"
	fi
	if [ ${clear_cache} == 1 ] && [ ${use_user} == "root" ]; then
		echo 3 > /proc/sys/vm/drop_caches
		printf "${title} Cache && buffers cleared\n"
	fi
	printf "${title} Starting ${server_name}\n"
	/usr/bin/screen -AmdS ${screen_name} ${start1} ./hlds_run -game cstrike +ip ${hlds_ip} +port ${hlds_port} +map ${hlds_map} +maxplayers ${hlds_players} ${hlds_options} -pidfile ${hlds_pid}
	sleep 3
	${start1} taskset -pc ${usecore} `cat ${path}/${hlds_pid}` > /dev/null
	${start1} renice -n ${priority} -p `cat ${path}/${hlds_pid}` > /dev/null
	if [ "`ps -ef | grep hlds_ | grep -v hlds_run | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | awk '{print $2}'`" = "`cat $path/$hlds_pid`" ]; then
		printf "${title} Server successfully started! :)\n"
	else
		printf "${title}${txtred} Server crashed on start :(\n"
	fi
}

kill_process() {
	if [ "`ps -ef | grep hlds_ | grep -v hlds_run | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | wc -l`" -gt 0 ]; then
		printf "${title} Kill: `ps -ef | grep SCREEN | grep ${screen_name} | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep`\n"
		${start1} kill -9 "`ps -ef | grep SCREEN | grep ${screen_name} | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | awk '{print $2}'`"
		${start1} rm -f ${path}/${hlds_pid}
	else
		printf "${title}${txtylw} Cannot kill hlds process of ${server_name} server\n"
	fi
}

stop() {
	if [ "`ps -ef | grep SCREEN | grep ${screen_name} | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | awk '{print $2}' | wc -l`" -eq 1 ]; then
		/usr/bin/screen -dr `ps -ef | grep SCREEN | grep ${screen_name} | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | awk '{print $2}'`.${screen_name} -p 0 -X eval "stuff "quit""
		/usr/bin/screen -dr `ps -ef | grep SCREEN | grep ${screen_name} | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | awk '{print $2}'`.${screen_name} -p 0 -X eval "stuff "$(printf \\r)""
		sleep 1
		${start1} rm -rf ${path}/${hlds_pid}
		
		if [ "`ps -ef | grep hlds_ | grep -v hlds_run | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | wc -l`" -gt 0 ]; then
			printf "${title}${txtred} Server not stopped!\n"
		else
			printf "${title} Server has been stopped\n"
		fi
	else
		printf "${title}${txtylw} Cannot stop server ${server_name}, screen session not found!\n"
	fi
}

status() {
	printf "${title} Get status of server ${server_name}\n"
	${start1} ${checker_cmd} -retry 3 -interval 2 -a2s ${hlds_ip}:${hlds_port} | grep ${hlds_ip}
	exit 1
}

console() {
	if [ "`ps -ef | grep SCREEN | grep ${screen_name} | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | wc -l`" -gt 0 ] && [ "`ps -ef | grep hlds_ | grep -v hlds_run | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | awk '{print $2}'`" = "`cat ${path}/${hlds_pid}`" ]; then
		printf "${title} Connecting to ${server_name} server console\n"
		printf "${title}${txtylw} For exit from console press Ctrl+A,D\n"
		printf "${title}${txtylw} Don't press Ctrl+C\n"
		sleep 1
		/usr/bin/screen -wipe > /dev/null
		/usr/bin/screen -dr `ps -ef | grep SCREEN | grep ${screen_name} | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | awk '{print $2}'`.${screen_name}
	else
		printf "${title}${txtred} Cannot connect to ${server_name} server console, server not started!\n"
	fi
}

checker() {
	time=`date +%X`
	date=`date +%D`
	
	if [ -f ${checker_cmd} ]; then
		if [ ! -x ${checker_cmd} ]; then
			printf "${title}${txtred} Check run privileges of ${checker_cmd}\n"
			exit 1
		fi
	else
		printf "${title}${txtred} Check qstat/quakestat binar\n"
	fi
	
	checknoresp=`${checker_cmd} -retry 5 -interval 2 -a2s ${hlds_ip}:${hlds_port} | grep response`
	if [ -n "${checknoresp}" ]; then
		printf "${title} ${server_name} server is: ${txtred}[NO RESPONSE]\n"
		printf "[${time} - ${date}] *[NO RESPONSE]* ${checknoresp}\n" >> $path/checker.log
		kill_process
		sleep 1
		start
		sleep 1
		printf "StartUP ${title}:" >> ${path}/checker.log
		if [ "`ps -ef | grep hlds_ | grep -v hlds_run | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | awk '{print $2}'`" = "`cat $path/$hlds_pid`" ]; then
			printf " *[OK]* \n" >> ${path}/checker.log
		else
			printf " *[FAILED]* \n" >> ${path}/checker.log
		fi
		exit 1
	fi
	
	checkdown=`${checker_cmd} -retry 5 -interval 2 -a2s ${hlds_ip}:${hlds_port} | grep DOWN`
	if [ -n "${checkdown}" ]; then
		printf "${title} ${server_name} server is: ${txtred}[DOWN]\n"
		printf "[{$time} - ${date}] *[DOWN]* ${checkdown}\n" >> ${path}/checker.log
		start
		sleep 1
		printf "StartUP ${title}:" >> ${path}/checker.log
		if [ "`ps -ef | grep hlds_ | grep -v hlds_run | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | awk '{print $2}'`" = "`cat $path/$hlds_pid`" ]; then
			printf " *[OK]* \n" >> ${path}/checker.log
		else
			printf " *[FAILED]* \n" >> ${path}/checker.log
		fi
		exit 1
	fi
	
	checkup=`${checker_cmd} -retry 5 -interval 2 -a2s ${hlds_ip}:${hlds_port} | grep cstrike`
	if [ -n "${checkup}" ]; then
		printf "${title} ${server_name} server is: ${txtgrn}[OK]\n"
		printf "[${time} - ${date}] *[OK]* ${checkup}\n" >> ${path}/checker.log
	fi
	if [ "`ps -e -o pid,cpuid,nice,cmd | grep hlds_ | grep -v SCREEN | grep -v grep | grep -v sh | grep -v hlds_run | grep ${hlds_ip} | grep ${hlds_port} | awk '{print $3}'`" != ${priority} ]; then
		if [ "`ps -ef | grep hlds_ | grep -v hlds_run | grep ${hlds_ip} | grep ${hlds_port} | grep -v grep | awk '{print $2}'`" = "`cat $path/$hlds_pid`" ]; then
			printf "${title}${txtylw} ${server_name} server priority is changed because server is crashed\n"
			${start1} taskset -pc ${usecore} "`cat ${path}/${hlds_pid}`" > /dev/null
			${start1} renice -n ${priority} -p "`cat ${path}/${hlds_pid}`" > /dev/null
		else
			printf "${title}${txtylw} ${server_name} server priority cant be restore because not found pidfile!\n"
		fi
	else
		printf "${title} ${server_name} server priority is good!\n"
	fi
}

case "$1" in
	start)
		start
	;;
	stop)
		stop
	;;
	restart)
		stop
		kill_process
		sleep 2
		start
	;;
	status)
		status
	;;
	console)
		console
	;;
	checker)
		checker
	;;
	*)
	printf "${title} How to use: ${txtgrn}$0 {start|stop|restart|status|console|checker}${txtwht}\n"
	exit 1
esac

что делать?

taskset: failed to get pid 31254's affinity: No such process
renice: failed to get priority for 31254 (process ID): No such process

Можно полный вывод, а не эти обрезки? Похоже, ошибка происходит раньше, а то, что вы привели - уже её следствие. Процесс завершился, и пида нет.

ARTIsshoque
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.