Ignore:
Timestamp:
May 17, 2014, 6:01:31 PM (11 years ago)
Author:
alloc
Message:

More instance validation, switch to XMLStarlet, config.xml instead of serverconfig.xml, admins.xml instead of serveradmin.xml

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/usr/local/bin/7dtd-kill.sh

    r11 r14  
    11#!/bin/bash
    2 # Version 1
     2# Version 3
    33
    44# Tries to stop the 7dtd instance given as first parameter.
     
    1212checkRootLoadConf
    1313
    14 checkInstance $1
     14checkInstanceValid $1
    1515
    1616res=$(isRunning $1)
    1717if [ $res -eq 1 ]; then
    18         telnetCommand $1 shutdown
    19         sleep 1
    20         res=$(isRunning $1)
    21         if [ $res -eq 1 ]; then
     18        echo "Trying to gracefully shutdown..."
     19        tmp=$(telnetCommand $1 shutdown)
     20        echo "Waiting for server to shut down..."
     21       
     22        waittime=0
     23        maxwait=5
     24        until [ $(isRunning $1) -eq 0 ] || [ $waittime -eq $maxwait ]; do
     25                (( waittime++ ))
     26                sleep 1
     27                echo $waittime/$maxwait
     28        done
     29       
     30        if [ $(isRunning $1) -eq 1 ]; then
     31                echo "Failed, force closing server..."
    2232                start-stop-daemon --stop --pidfile $(getInstancePath $1)/7dtd.pid
    2333        fi
Note: See TracChangeset for help on using the changeset viewer.