| Rev | Line |   | 
|---|
| [6367] | 1 | #!/bin/bash | 
|---|
 | 2 | ########################################################################## | 
|---|
 | 3 | #   orxonox - the future of 3D-vertical-scrollers                        # | 
|---|
 | 4 | #                                                                        # | 
|---|
 | 5 | #   Copyright (C) 2004 orx                                               # | 
|---|
 | 6 | #                                                                        # | 
|---|
 | 7 | #   This program is free software; you can redistribute it and/or modify # | 
|---|
 | 8 | #   it under the terms of the GNU General Public License as published by # | 
|---|
 | 9 | #   the Free Software Foundation; either version 2, or (at your option)  # | 
|---|
 | 10 | #   any later version.                                                   # | 
|---|
 | 11 | #                                                                        # | 
|---|
 | 12 | #   ### File Specific:                                                   # | 
|---|
 | 13 | #   main-programmer: Christoph Renner                                    # | 
|---|
 | 14 | #   co-programmer: ...                                                   # | 
|---|
 | 15 | #                                                                        # | 
|---|
 | 16 | #                                                                        # | 
|---|
 | 17 | #   This script starts an orxonox server and restarts it when it crashes.# | 
|---|
 | 18 | #   it also creates a logfile for each start                             # | 
|---|
 | 19 | #                                                                        # | 
|---|
 | 20 | ########################################################################## | 
|---|
 | 21 |  | 
|---|
 | 22 |  | 
|---|
 | 23 | PORT="9999" | 
|---|
 | 24 |  | 
|---|
 | 25 | ORXONOXBINARY="./orxonox" | 
|---|
 | 26 | LOGDIR="/tmp/orxonox_log" | 
|---|
 | 27 | LOGPREFIX="orxonox" | 
|---|
 | 28 | SLEEPTIME="5" | 
|---|
 | 29 |  | 
|---|
 | 30 | ORXONOXOPTIONS=" --dedicated-server $PORT" | 
|---|
 | 31 |  | 
|---|
 | 32 | while true; do | 
|---|
 | 33 |         SD=$(date +'%Y-%m-%d-%H:%M:%S'); | 
|---|
 | 34 |         CMDLINE="$ORXONOXBINARY $ORXONOXOPTIONS" | 
|---|
 | 35 |         LOGFILE="$LOGDIR/$LOGPREFIX-$SD.log" | 
|---|
 | 36 |         echo $CMDLINE; | 
|---|
 | 37 |         nice $CMDLINE &> "$LOGFILE"; | 
|---|
 | 38 |  | 
|---|
 | 39 |         echo "Now is $(date +'%Y-%m-%d-%H:%M:%S')" >> "$LOGFILE"; | 
|---|
 | 40 |  | 
|---|
 | 41 |         echo -e "\n\n\nyou have $SLEEPTIME s to kill this script\n\n\n"; | 
|---|
 | 42 |         sleep $SLEEPTIME | 
|---|
 | 43 | done | 
|---|
 | 44 |  | 
|---|
 | 45 |  | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.