Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24

Thread: [CoD2/CoD4] Server auto-restart

  1. #21
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,005
    Thanks
    439
    Thanked 168 Times in 130 Posts
    cod2 autoboot file
    Code:
    #!/bin/bash
    #
    # call of duty 2 auto restart script.
    # including a logfile relocater
    #
    # pluginLoader
    #cd /home/olger/HIGHJUMP/
    #export LD_LIBRARY_PATH="/home/olger/HIGHJUMP" 
    
    #
    # Settings:
    cd "/home/olger/HIGHJUMP/"
    MOD="tdm2"
    CONSOLE_FILE="console_mp_server.log"
    SCREEN_FILE="screenlog.0"
    OUTPUT_DIR=".console/"
    #
    # DO NOT EDIT BELOW
    CONSOLE_FILE_PATH=".callofduty2/$MOD/$CONSOLE_FILE"
    CONSOLE_FILE_PATH_DST=$OUTPUT_DIR$CONSOLE_FILE
    SCREEN_FILE_PATH_DST=$OUTPUT_DIR$SCREEN_FILE
    TMP_OUTPUT_FILE="autoboot.log"
    
    if [ ! -d $OUTPUT_DIR ]; then
    	mkdir -p $OUTPUT_DIR
    fi
    #
    #
    for count in {1..10} ; do
    
    	"LD_PRELOAD=/home/olger/HIGHJUMP/libcod2_1_0_newest.so ./cod2_lnxded_1_0a_va_loc_128" "$@"
    	if [ -f $TMP_OUTPUT_FILE ]; then
    		rm $TMP_OUTPUT_FILE
    	fi
    	if [ -f $CONSOLE_FILE_PATH ]; then
    		mv $CONSOLE_FILE_PATH "$CONSOLE_FILE_PATH_DST$count"
    		echo "moved $CONSOLE_FILE_PATH to $CONSOLE_FILE_PATH_DST$count"
    	fi
    	if [ -f $SCREEN_FILE ]; then
    		tail -n 2000 $SCREEN_FILE > "$SCREEN_FILE_PATH_DST$count"
    		echo "copied last 2k lines from $SCREEN_FILE to $SCREEN_FILE_PATH_DST$count"
    	fi	
    	echo "Times Crached:" $count >> autoboot.log
    	echo "Restarting the server..."
    	sleep 5;
    done
    exit 1
    to start the server in the screen
    Code:
    ./cod2_lnxded_autoBoot +set dedicated 2 +set net_ip 46.4.55.66 +set net_port 28963 +set sv_maxclients 52 +exec servercar.cfg + exec pws.cfg +set fs_game tdm2 + set sv_cracked 1
    error
    Code:
    ERROR: ld.so: object '/home/olger/HIGHJUMP/libcod2_1_0_newest.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
    ./cod2_lnxded_autoBoot: line 28: ./cod2_lnxded: No such file or directory
    ERROR: ld.so: object '/home/olger/HIGHJUMP/libcod2_1_0_newest.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
    Restarting the server...
    ERROR: ld.so: object '/home/olger/HIGHJUMP/libcod2_1_0_newest.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
    What am i doing wrong?

  2. #22
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    1,968
    Thanks
    1,924
    Thanked 1,065 Times in 740 Posts
    Looks like your LD_PRELOAD is still global from a previous test, restart putty (and/or restart screen session) and try this:

    Code:
    #!/bin/bash
    #
    # call of duty 2 auto restart script.
    # including a logfile relocater
    #
    # pluginLoader
    #cd /home/olger/HIGHJUMP/
    
    # exporting library path should never hurt
    export LD_LIBRARY_PATH="/home/olger/HIGHJUMP"
    
    #
    # Settings:
    cd "/home/olger/HIGHJUMP/"
    MOD="tdm2"
    CONSOLE_FILE="console_mp_server.log"
    SCREEN_FILE="screenlog.0"
    OUTPUT_DIR=".console/"
    #
    # DO NOT EDIT BELOW
    CONSOLE_FILE_PATH=".callofduty2/$MOD/$CONSOLE_FILE"
    CONSOLE_FILE_PATH_DST=$OUTPUT_DIR$CONSOLE_FILE
    SCREEN_FILE_PATH_DST=$OUTPUT_DIR$SCREEN_FILE
    TMP_OUTPUT_FILE="autoboot.log"
    
    if [ ! -d $OUTPUT_DIR ]; then
    	mkdir -p $OUTPUT_DIR
    fi
    #
    #
    for count in {1..10} ; do
    
    	LD_PRELOAD=/home/olger/HIGHJUMP/libcod2_1_0_newest.so ./cod2_lnxded_1_0a_va_loc_128 "$@"
    	if [ -f $TMP_OUTPUT_FILE ]; then
    		rm $TMP_OUTPUT_FILE
    	fi
    	if [ -f $CONSOLE_FILE_PATH ]; then
    		mv $CONSOLE_FILE_PATH "$CONSOLE_FILE_PATH_DST$count"
    		echo "moved $CONSOLE_FILE_PATH to $CONSOLE_FILE_PATH_DST$count"
    	fi
    	if [ -f $SCREEN_FILE ]; then
    		tail -n 2000 $SCREEN_FILE > "$SCREEN_FILE_PATH_DST$count"
    		echo "copied last 2k lines from $SCREEN_FILE to $SCREEN_FILE_PATH_DST$count"
    	fi	
    	echo "Times Crached:" $count >> autoboot.log
    	echo "Restarting the server..."
    	sleep 5;
    done
    exit 1
    timescale 0.01

  3. The Following User Says Thank You to kung foo man For This Useful Post:

    Ni3ls (10th June 2018)

  4. #23
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,005
    Thanks
    439
    Thanked 168 Times in 130 Posts
    Okay server is running.
    What kind of crashed will activate the script?
    "killserver" doesnt do anything

  5. #24
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    1,968
    Thanks
    1,924
    Thanked 1,065 Times in 740 Posts
    just type quit?
    timescale 0.01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •