Benutzerinformationen überspringen
Wohnort: http://goo.gl/bwF1X
Ingame-Name: Formeo [DE]
Renommeemodifikator: 11
Quellcode |
|
1 |
while true;do ./teeworlds_srv;done |
Keine Angst ich für meinen Teil halt von DDrace genauso viel wie von City :P beides fürn Kübel
Ganz Ehrlich?
Hast du auch mal an Kritik gedacht?
Was er verbessern kann?
Was er falsch gemacht hat?
Welche Bilde findest du insbesondere schlecht?
Benutzerinformationen überspringen
Wohnort: http://goo.gl/bwF1X
Ingame-Name: Formeo [DE]
Renommeemodifikator: 11
Benutzerinformationen überspringen
Wohnort: ( ͡° ͜ʖ ͡°)
Beruf: ( ͡° ͜ʖ ͡°)
Ingame-Name: ( ͡° ͜ʖ ͡°)
Renommeemodifikator: 13
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
#!/bin/bash # Configs are saved in config/prefixX.cfg X=The server number # Server logs are saved in logs/prefixX.log X=The server number # Packages used: su, nohup and pkill # Define the server file server_file=teeworlds_srv # Define the number of servers server_num=1 # Define the user under which the server runs user=teeworlds # Define the config prefix config_prefix=insta # Make log files (1=true / 0=false) logs=0 if [ -z $1 ] then echo "Please supply an argument" echo "Usage: $0 {start|stop|restart}" exit 1 fi cd $(dirname $0) case "$1" in start) if [ "finger ${user} | grep -c 'Login'" = 0 ]; then echo "No such user ""${user}""" exit 1 fi if ([ "$(id -u)" != "0" ] && [ "$(whoami)" != "${user}" ]); then echo "This script must be run as root or as ${user}" exit 1 fi if [ ${logs} != 0 ]; then mkdir -p logs fi chown -R ${user} * chmod -R ug+rwx * for ((i = 1; i <= ${server_num}; i++)) do if [ "$(id -u)" == "0" ]; then if [ ${logs} != 0 ]; then rm -f ${PWD}/logs/${config_prefix}${c}.log &> /dev/null su -l ${user} -c "cd ${PWD} && nohup sh ${PWD}/server.sh ${server_file} ${config_prefix} ${i} > ${PWD}/logs/${config_prefix}${i}.log &" else su -l ${user} -c "cd ${PWD} && nohup sh ${PWD}/server.sh ${server_file} ${config_prefix} ${i} > /dev/null &" fi else if [ ${logs} != 0 ]; then rm -f ${PWD}/logs/${config_prefix}${c}.log &> /dev/null nohup sh ${PWD}/server.sh ${server_file} ${config_prefix} ${i} > ${PWD}/logs/${config_prefix}${i}.log & else nohup sh ${PWD}/server.sh ${server_file} ${config_prefix} ${i} > /dev/null & fi fi sleep 0.1 done ;; stop) for ((i = 1; i <= ${server_num}; i++ )) do pkill -f "sh ${PWD}/server.sh ${server_file} ${config_prefix} ${i}" sleep 0.1 pkill -f "${PWD}/${server_file} -f ${PWD}/config/${config_prefix}${i}.cfg" done ;; restart) for ((i = 1; i <= ${server_num}; i++ )) do pkill -f "${PWD}/${server_file} -f ${PWD}/config/${config_prefix}${i}.cfg" sleep 0.1 done ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0 |
Quellcode |
|
1 2 3 4 5 6 7 8 |
#!/bin/bash while true; do ${PWD}/${1} -f ${PWD}/config/${2}${3}.cfg echo "RESTART!" sleep 0.1 done |