|
|
Строка 1: |
Строка 1: |
− | ==Подготовка==
| + | Your cranium must be protecting some very vualbale brains. |
− | * Установим нужные утилиты и библиотеки (для 64-х битный систем)(ia32-libs):
| |
− | # aptitude install screen ia32-libs
| |
− | * Создадим пользователя из под которого будем запускать сервер:
| |
− | # adduser kfds
| |
− | ==Установка==
| |
− | * Скачаем утилиту hldsupdatetool.bin для загрузки и обновления сервера.
| |
− | # su kfds
| |
− | $ cd ~
| |
− | $ wget http://storefront.steampowered.com/download/hldsupdatetool.bin
| |
− | * Распакуем steam клиент
| |
− | $ chmod +x hldsupdatetool.bin
| |
− | $ ./hldsuptatetool.bin
| |
− | * Обновим steam клиент до последний версии
| |
− | $ ./steam
| |
− | * Скачаем сервер KF в каталог kfds, в дальнейшем этой командой можно будет его обновлять.
| |
− | $ ./steam -command update -game killingfloor -dir ./kfds
| |
− | * После того как скачка закончилась переходим к следующей части: настройке
| |
− | ==Настройка==
| |
− | | |
− | ==Автозапуск==
| |
− | * Создаем в каталоге /etc/init.d файл kf со следующим содержимым:
| |
− | #!/bin/sh
| |
− |
| |
− | ### BEGIN INIT INFO
| |
− | # Provides: kf
| |
− | # Required-Start: $network $remote_fs $syslog
| |
− | # Required-Stop: $network $remote_fs $syslog
| |
− | # Default-Start: 2 3 4 5
| |
− | # Default-Stop:
| |
− | # Short-Description: Start Killing Floor daemon
| |
− | ### END INIT INFO
| |
− |
| |
− | NAME="kf"
| |
− | GAME="Killing Floor"
| |
− | IP="213.141.136.245"
| |
− | SRV_LIST="kf1 kf2 kf3"
| |
− | CFG_PREFIX="kfsrv_"
| |
− | MAP="KF-BioticsLab"
| |
− | SLOTS="6"
| |
− | BIN="./ucc-bin"
| |
− | USER="kfds"
| |
− | CPU="0,1"
| |
− | HIGHPRIORITY=0
| |
− | GAME_PATH="/home/kfds/kfds/system/"
| |
− |
| |
− | # Screen command
| |
− | INTERFACE="/usr/bin/screen -AmdS"
| |
− |
| |
− | daemon_start() {
| |
− | OPTS=" server $MAP.rom?game=KFmod.KFGameType?VACSecured=true?MaxPlayers=$SLOTS -nohomedir ini=$SRV.ini"
| |
− |
| |
− | # Check if the pid files currently exist
| |
− | if [ -f $GAME_PATH/$PORT.pid ]; then
| |
− | # Process is still running.
| |
− | if [ "$(ps -p `cat $GAME_PATH/$SRV.pid` | wc -l)" -gt 1 ]; then
| |
− | echo "Cannot start $NAME. Server is already running."
| |
− | else
| |
− | # clean pid file
| |
− | rm $GAME_PATH/$SRV.pid
| |
− | daemon_start
| |
− | fi
| |
− | else
| |
− | # Server is not running start the server.
| |
− | if [ -x $GAME_PATH/$BIN ]; then
| |
− | cd $GAME_PATH
| |
− | $INTERFACE $SRV su $USER -c "taskset -c $CPU $GAME_PATH/$BIN $OPTS"
| |
− | sleep 1
| |
− | # Find and write current process id of the daemon process
| |
− | ps -ef | grep -v SCREEN | grep -v taskset | grep $SRV | grep $BIN | grep -v grep | awk '{ print $2}' > $GAME_PATH/$SRV.pid
| |
− | echo "$SRV started."
| |
− | sleep 1
| |
− | if [ $HIGHPRIORITY = 1 ]; then
| |
− | renice -2 `cat $GAME_PATH/$SRV.pid` >/dev/null 2>&1
| |
− | fi
| |
− | fi
| |
− | fi
| |
− | }
| |
− |
| |
− | daemon_stop() {
| |
− | if [ -f $GAME_PATH/$SRV.pid ]; then
| |
− | echo "Stopping $SRV."
| |
− | kill -9 `cat $GAME_PATH/$SRV.pid`
| |
− | echo "$SRV stopped."
| |
− | else
| |
− | echo -e "Can't stop $SRV. Server is not running."
| |
− | fi
| |
− | }
| |
− |
| |
− | show_info() {
| |
− | if [ -f $GAME_PATH/$SRV.pid ]; then
| |
− | echo "Server status: ONLINE"
| |
− | else
| |
− | echo "Server status: OFFLINE"
| |
− | fi
| |
− | echo "Server name: $NAME-$PORT"
| |
− | echo "Server game: $GAME"
| |
− | echo "Server IP: $IP"
| |
− | echo "Server port: $PORT"
| |
− | echo "Server size: $SLOTS players"
| |
− | echo "=============================================="
| |
− | }
| |
− |
| |
− | case "$1" in
| |
− | start)
| |
− | for SRV in $SRV_LIST; do
| |
− | daemon_start
| |
− | done
| |
− | ;;
| |
− | stop)
| |
− | for SRV in $SRV_LIST; do
| |
− | daemon_stop
| |
− | done
| |
− | ;;
| |
− | restart)
| |
− | for SRV in $SRv_LIST; do
| |
− | daemon_stop
| |
− | sleep 1
| |
− | daemon_start
| |
− | done
| |
− | ;;
| |
− | info)
| |
− | for PORT in $PORT_LIST; do
| |
− | show_info
| |
− | done
| |
− | ;;
| |
− | *)
| |
− | echo "Usage $0 start|restart|stop|info"
| |
− | esac
| |
− |
| |
− | exit 0
| |
− | * Делаем автоматический старт демона при загрузке
| |
− | update-rc.d kf defaults
| |
− | That saves me. Thanks for being so senbsile!
| |
− | | |
− | ==Список белых карт==
| |
− | ==Ссылки по теме==
| |
Your cranium must be protecting some very vualbale brains.