Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[v1.4] Problem Linux event.sh Multi-Welten
#1
Ich hab das Problem, dass die event.sh nicht für beide Welten rechnet.

event.sh voher:
Quote:#!/bin/sh
# Copyright 2010 Lekensteyn
# This script is public domain and comes with NO WARRANTY of any kind
#
# Events handler (handles build queue, attacks, etc)
if test `id -u` -eq 0;then
sudo -u nobody -- "$0"
exit
fi
running=true
trap 'running=false' 1 2 3 15
cd "$(dirname "$0")/.."
BASEDIR="`pwd`"
PIDFILE="$BASEDIR/tmp/event.pid"
killed=
# if a pidfile still exist (unclean shutdown), kill that pid and wait
# 2 seconds for it to catch our signal
test -f "$PIDFILE" && kill -15 "`cat "$PIDFILE"`" >/dev/null && killed=1
printf $$ > "$PIDFILE"
test -n "$killed" && sleep 2
cd htdocs/welt1/daemons
run(){
test -f "$PIDFILE" || exit 2
sleep 1
if test ! -S "$BASEDIR/tmp/mysql.sock";then
echo 'MySQL is not running.'
return
fi
# start PHP, run build queues, attacks, etc
env -i LD_LIBRARY_PATH="$BASEDIR/lib" "$BASEDIR/php/php" event.php &
pid=$!
# check if we still should run (if we have not been killed)
while $running;do
# is PHP not running anymore? Restart it
if ! kill -0 $pid 2>/dev/null >/dev/null;then
run
return
fi
# and wait a second as we do not have to check realtime
sleep 1
done
# kill PHP
kill -15 $pid 2>/dev/null >/dev/null
}
run
detect_pid=`cat "$PIDFILE"`
test "$detect_pid" = $$ && rm -f "$PIDFILE"

Nun dachte ich mir, warum nicht das selbe nochmal unten anhängen und im unteren teil statt
cd htdocs/welt1/daemons
würde ich
cd htdocs/welt2/daemons
schreiben

Also so :

Quote:#!/bin/sh
# Copyright 2010 Lekensteyn
# This script is public domain and comes with NO WARRANTY of any kind
#
# Events handler (handles build queue, attacks, etc)
if test `id -u` -eq 0;then
sudo -u nobody -- "$0"
exit
fi
running=true
trap 'running=false' 1 2 3 15
cd "$(dirname "$0")/.."
BASEDIR="`pwd`"
PIDFILE="$BASEDIR/tmp/event.pid"
killed=
# if a pidfile still exist (unclean shutdown), kill that pid and wait
# 2 seconds for it to catch our signal
test -f "$PIDFILE" && kill -15 "`cat "$PIDFILE"`" >/dev/null && killed=1
printf $$ > "$PIDFILE"
test -n "$killed" && sleep 2
cd htdocs/welt1/daemons
run(){
test -f "$PIDFILE" || exit 2
sleep 1
if test ! -S "$BASEDIR/tmp/mysql.sock";then
echo 'MySQL is not running.'
return
fi
# start PHP, run build queues, attacks, etc
env -i LD_LIBRARY_PATH="$BASEDIR/lib" "$BASEDIR/php/php" event.php &
pid=$!
# check if we still should run (if we have not been killed)
while $running;do
# is PHP not running anymore? Restart it
if ! kill -0 $pid 2>/dev/null >/dev/null;then
run
return
fi
# and wait a second as we do not have to check realtime
sleep 1
done
# kill PHP
kill -15 $pid 2>/dev/null >/dev/null
}
run
detect_pid=`cat "$PIDFILE"`
test "$detect_pid" = $$ && rm -f "$PIDFILE"

#!/bin/sh
# Copyright 2010 Lekensteyn
# This script is public domain and comes with NO WARRANTY of any kind
#
# Events handler (handles build queue, attacks, etc)
if test `id -u` -eq 0;then
sudo -u nobody -- "$0"
exit
fi
running=true
trap 'running=false' 1 2 3 15
cd "$(dirname "$0")/.."
BASEDIR="`pwd`"
PIDFILE="$BASEDIR/tmp/event.pid"
killed=
# if a pidfile still exist (unclean shutdown), kill that pid and wait
# 2 seconds for it to catch our signal
test -f "$PIDFILE" && kill -15 "`cat "$PIDFILE"`" >/dev/null && killed=1
printf $$ > "$PIDFILE"
test -n "$killed" && sleep 2
cd htdocs/welt2/daemons
run(){
test -f "$PIDFILE" || exit 2
sleep 1
if test ! -S "$BASEDIR/tmp/mysql.sock";then
echo 'MySQL is not running.'
return
fi
# start PHP, run build queues, attacks, etc
env -i LD_LIBRARY_PATH="$BASEDIR/lib" "$BASEDIR/php/php" event.php &
pid=$!
# check if we still should run (if we have not been killed)
while $running;do
# is PHP not running anymore? Restart it
if ! kill -0 $pid 2>/dev/null >/dev/null;then
run
return
fi
# and wait a second as we do not have to check realtime
sleep 1
done
# kill PHP
kill -15 $pid 2>/dev/null >/dev/null
}
run
detect_pid=`cat "$PIDFILE"`
test "$detect_pid" = $$ && rm -f "$PIDFILE"

Dies hat auch geklappt !
ABER es klappt nur solange beide welten in
htdocs/welt1/include/config.php
und
htdocs/welt2/include/config.php
auf die selbe Datenbank zugreifen. (z.B. lan-w1)

Wenn ich aber htdocs/welt2/include/config.php die Datenbank in lan-w2 umschreibe (die auch exestiert und alles fuktioniert ect.) , werden die events (angriffe ect.) nicht berechnet.

somit wird dann nur welt 1 berechnet und nicht mehr welt 2.

Wie kann ich nun beide Welten eine unterschiedliche Datenbank geben und auf beiden Welten die events auch berechnet lassen?

MfG
Crusher
Reply
#2
Kannst du mal testen, ob es funktioniert, wenn du nur eine Welt am laufen hast, aber sie auf eine andere Datenbank als "lan" einstellst?

LG
Molt
Reply
#3
Ja das läuft. (Eben getestet)
Aber ich möchte ja auch 2 Welten Smile
Reply
#4
Jo schon klar, aber wenn das nicht funktioniert hätte, hätten auch 2 welten nicht gefunzt...
Aber so fällt mir nix dazu ein, sorry.

LG
Molt
Reply
#5
(16.03.2011, 15:12)Molt Wrote: Jo schon klar, aber wenn das nicht funktioniert hätte, hätten auch 2 welten nicht gefunzt...
Aber so fällt mir nix dazu ein, sorry.

LG
Molt

schade...

Kann mir wer anders helfen?
Ist hier nicht irgendeiner der sich mit diesen Linux Events auskennt? Big Grin

MfG
Reply
#6
Lekensteyn
Reply
#7
You should change the location of the PIDFILE of the events handler:
Code:
PIDFILE="$BASEDIR/tmp/event.pid"
When changing this file, make sure the directory is writable.
Found my post helpful? Rate me Big Grin
Project: creating a compact and easy to setup DSLan (Linux) (Windoze is in development)
Reply
#8
Dieser Tipp von Lekensteyn funktioniert so nicht. Ich unterhalte mich mit Lekensteyn über PN weiter bis wir/ich die Lösung habe.

Das Resultat wir natürlich hier geposted.


MfG
Crusher
Reply
#9
This should work now, all you have to do is specify multiple worlds in the worlds variable. It runs daemons in htdocs/*/daemons where * is a folder specified by you.
You can overwrite your current event.sh.
I've not tested it though but there are no syntax errors.

http://pastebin.com/RLjy4PCD
Direct download: http://pastebin.com/raw.php?i=RLjy4PCD
Found my post helpful? Rate me Big Grin
Project: creating a compact and easy to setup DSLan (Linux) (Windoze is in development)
Reply
#10
FUNKTIONIERT ! Smile
Reply
#11
Es funkltioniert, ja

aber nicht gut

Er berechnet ständig daten falsch, zB man rekrutiert 200 sperrträger und hat auf einmal 10.000

Lekensteyn, pls help me

it works, but with very much errors!

Sorry for bad english!
Reply
#12
For me it works without errors and well...
LG
steffen
Reply
#13
dann hilf mir bitte steffen

seit wann hast du linux?
Reply




Users browsing this thread: 1 Guest(s)