[Freeciv-Dev] automaticly restarting script
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi!
freeciv is great and I think a lot more people would offer
permanent servers, if they would automatically restart as the
ones at civserver.freeciv.org do. You obviously already have such
scripts, but I still sat down and wrote one myself (this adds to
my linux experience). It's a quick and dirty thing, but it works
rather well, IMO. You can include it in the distribution package,
e.g. in a contrib directory. Otherwise, maybe supply your
scripts. Ahh, yes, you may add a GPL license statement.
One thing that's missing is saving and restoring games. I thought
of doing that with expect as well, but I guess there are better
ways to do that.
Bye, Bernhard
ps: I'm not subscribed to this list. #!/usr/bin/expect -f
set quit 0
#while {1} {
spawn civserver -r rc -m
set timeout 1
expect_background "The map has" {
send_user "expect: game start detected\n"
expect_background "Lost connection" {
set quit 1
send "list\n"
expect {
"is connected from" { set quit 0 }
"is being observed from" { set quit 0 }
}
if {1==$quit} {
send "metainfo restarting in 60 s for lack of players\n"
set quitid [after 60000 {
send_user "expect: quitting ...\n"
send -i $spawn_id "quit\n"
}]
}
} "has rejoined the game." {
if {1==$quit} {
after cancel $quitid
set quit 0
send_user "expect: quit cancelled :)\n"
send "metainfo Players welcome\n"
}
}
}
interact
wait
#}
#while
#!/usr/bin/expect -f
while {1} {
spawn ./xcs
interact
wait
}
- [Freeciv-Dev] automaticly restarting script,
Bernhard Kuemel <=
|
|