start-stop-daemon (Скрипт поднятия cs сервера, не получается сделать)

На самом деле это единственный раздел про unix на этом форуме

Модераторы: /dev/random, Модераторы разделов

Timur4ik
Сообщения: 16

start-stop-daemon

Сообщение Timur4ik »

при запуске ./test start
start-stop-daemon: group `ame' not found
Кажеться дело в том что он строку comands="./hlds_run -game
воспринимает как продолжение команды.

Код: Выделить всё

#!/bin/bash

PIDFILE="/home/gamer/hlds_classic/cs.pid"
comands="./hlds_run -game cstrike -nomaster +map cs_assault +port 27015 -maxplayers 24 +mp_freezetime 3 +exec server.cfg -pingboost 1 +sys_ticrate 10000 +sv_maxupdaterate 100"

RETVAL=0

path="/home/gamer/hlds_classic"

start() {
if [ -d $path ]; then
cd $path
start-stop-daemon --start --background --make-pidfile --pidfile ${PIDFILE} --chuid gamer -a ${comands}

touch ./cstrike.run
fi
}

stop() {
if [ -f $path/cstrike.run ]; then
start-stop-daemon --stop --quiet --exec ${comands}

cd $path
rm -R ./cstrike.run
fi
}



case "$1" in
start)
start
echo "CS Server-1 starting"
;;
stop)
stop
echo "CS Server-1 stoping"
;;
restart)
echo "Restarting CS-server"
stop
sleep 2
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac

exit $RETVAL
Спасибо сказали:
Timur4ik
Сообщения: 16

Re: start-stop-daemon

Сообщение Timur4ik »

Тему можно закрывать, вот сделал так.
pastebin.com/m500a28e9
Все работает как я хотел, код может и не самый красивый.
Спасибо сказали:
pelmen
Сообщения: 1268
ОС: debian

Re: start-stop-daemon

Сообщение pelmen »

дай адресок поиграть :)
Спасибо сказали: