Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2001:
[Freeciv-Dev] Re: automaticly restarting script
Home

[Freeciv-Dev] Re: automaticly restarting script

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Bernhard Kuemel <darsie@xxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: automaticly restarting script
From: Tuomas Airaksinen <tuomas.airaksinen@xxxxxxxxxx>
Date: Sun, 15 Apr 2001 12:05:26 +0300

I just use following civloop script at tuma.stc.cx:5555:

#!/bin/bash
while true; do
        echo "Civserver launched $(date)" >> my_civlog.txt
        civserver -q 500 -r my_civscript.txt >> my_civlog.txt
done

And it works. 

On Thu, Apr 12, 2001 at 10:00:29PM +0200, Bernhard Kuemel wrote:
> 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
> }


-- 
Best regards, Tuomas Airaksinen 
For That Matter: http://tuma.stc.cx/

Attachment: pgpaJ96TpT7aA.pgp
Description: PGP signature


[Prev in Thread] Current Thread [Next in Thread]