Попробуй:
screen -A -m -d -S check_css_cw1 ./cheker_css.py "xxx.xxx.xxx.xxx" "27015" "kill $(ps -ef | awk '! /awk/ && /css_cw1/ {print $2}')"
#!/bin/sh
echo "Starting CS:Source cw"
sleep 1
screen -A -m -d -S cw1 /путь/servers/cw1/css/cw1.sh
#!/bin/sh
while true ; do
/путь/servers/cw1/css/srcds_run -console +ip 0.0.0.0 -game cstrike +maxplayers 11 -port 27215 -tickrate 66 +fps_max 600 +map de_dust2 +tv_port 27245
done
$(ps aux | grep 27215 | grep srcds_run | awk '{print "kill -9 " $2}')
ps aux | grep 27215 | grep srcds_run | awk '{print $2}' | xargs kill -9
RETRY: 4
[--------- Send [OK] to xxx.xxx.xxx.xxx:27017 waiting response for 120 sec....
[--------- Error:timed out on server ip xxx.xxx.xxx.xxx:27017
RETRY: 5
[--------- Retry is more than 5, send restart shell cmd to system!
ps aux | grep 27017 | grep srcds_run | awk '{print }' | xargs kill -9
kill: неверный ключ -- «g»
Usage:
kill [options] <pid> [...]
Options:
<pid> [...] send signal to every <pid> listed
-<signal>, -s, --signal <signal>
specify the <signal> to be sent
-l, --list=[<signal>] list all signal names, or convert one to a name
-L, --table list all signal names in a nice table
-h, --help display this help and exit
-V, --version output version information and exit
For more details see kill(1).
ps aux | grep 27017 | grep srcds_run | awk '{print $2}' | xargs kill -9
ps aux | grep 27017 | grep srcds_run | [B][COLOR="Red"]awk '{print $2}' [/COLOR][/B]| xargs kill -9
ps aux | grep 27017 | grep srcds_run | [B][COLOR="Red"]awk '{print }'[/COLOR][/B] | xargs kill -9
"kill -9 `ps aux | grep 27017 | grep srcds_linux | grep -v grep | awk '{print($2)}'`"
[--------- Send [OK] to 192.168.40.189:27017 waiting response for 120 sec....
[--------- Error:timed out on server ip 192.168.40.189:27017
RETRY: 1
[--------- Send [OK] to 192.168.40.189:27017 waiting response for 120 sec....
[--------- Error:timed out on server ip 192.168.40.189:27017
RETRY: 2
[--------- Send [OK] to 192.168.40.189:27017 waiting response for 120 sec....
[--------- Error:timed out on server ip 192.168.40.189:27017
RETRY: 3
[--------- Send [OK] to 192.168.40.189:27017 waiting response for 120 sec....
[--------- Error:timed out on server ip 192.168.40.189:27017
RETRY: 4
[--------- Send [OK] to 192.168.40.189:27017 waiting response for 120 sec....
[--------- Error:timed out on server ip 192.168.40.189:27017
RETRY: 5
[--------- Retry is more than 5, send restart shell cmd to system!
[B][COLOR="red"]kill -9 3752
sh: 1: kill: No such process[/COLOR][/B]
[--------- Send [OK] to 192.168.40.189:27017 waiting response for 120 sec....
[--------- Error:timed out on server ip 192.168.40.189:27017
RETRY: 1
[--------- Send [OK] to 192.168.40.189:27017 waiting response for 120 sec....
[--------- Error:timed out on server ip 192.168.40.189:27017
RETRY: 2
[--------- Send [OK] to 192.168.40.189:27017 waiting response for 120 sec....
[--------- Error:timed out on server ip 192.168.40.189:27017
RETRY: 3
[--------- Send [OK] to 192.168.40.189:27017 waiting response for 120 sec....
[--------- Error:timed out on server ip 192.168.40.189:27017
RETRY: 4
[--------- Send [OK] to 192.168.40.189:27017 waiting response for 120 sec....
[--------- Error:timed out on server ip 192.168.40.189:27017
RETRY: 5
[--------- Retry is more than 5, send restart shell cmd to system!
[B][COLOR="Red"]kill -9 3752
sh: 1: kill: No such process[/COLOR][/B]
ps ax | grep srcds_linux | grep -v grep | grep 0.0.0.0 | grep 27017 | awk '{print $1}'
[COLOR="red"]9666[/COLOR]
#!/bin/sh
echo "Starting Monitoring gg"
sleep 1
screen -A -m -d -S mon_gg1 python /путь/srcds_status_checker.py "192.168.40.189" "27017" "kill -9 `ps ax | grep srcds_linux | grep -v grep | grep 0.0.0.0 | grep 27017 | awk '{print $1}'`"
Смотри, скрипт рабочий, как завершать серв - уже забота твоя.
echo "cw1 start"
kill $(ps -ef | awk '! /awk/ && /папка с сервером/ {print $2}')
sleep 1
screen -A -m -d -S cw1 /путь/cw1.sh
#!/bin/sh
echo "Starting CS:Source cw"
sleep 1
screen -A -m -d -S cw1 /путь/servers/cw1/css/cw1.sh
#!/bin/sh
while true ; do
/путь/servers/cw1/css/srcds_run -console +ip 0.0.0.0 -game cstrike +maxplayers 11 -port 27215 -tickrate 66 +fps_max 600 +map de_dust2 +tv_port 27245
done
#!/bin/sh
echo "Starting Monitoring cw1"
sleep 1
screen -A -m -d -S mon_cw1 python /путь/monitoring/srcds_status_checker.py "192.168.40.192" "27215" "kill -9 `ps ax | grep srcds_linux | grep -v grep | grep 0.0.0.0 | grep 27315 | awk '{print $1}'`"