Last change
on this file since 15 was 14, checked in by alloc, 11 years ago |
More instance validation, switch to XMLStarlet, config.xml instead of serverconfig.xml, admins.xml instead of serveradmin.xml
|
-
Property svn:executable
set to
*
|
File size:
839 bytes
|
Rev | Line | |
---|
[1] | 1 | #!/bin/bash
|
---|
[14] | 2 | # Version 3
|
---|
[10] | 3 |
|
---|
[9] | 4 | # Tries to stop the 7dtd instance given as first parameter.
|
---|
| 5 | # Returns:
|
---|
| 6 | # 0 : Done
|
---|
| 7 | # 1 : Was not running
|
---|
| 8 | # 2 : No instance name given
|
---|
| 9 | # 3 : No such instance
|
---|
| 10 |
|
---|
| 11 | . /usr/local/bin/7dtd-common.sh
|
---|
| 12 | checkRootLoadConf
|
---|
| 13 |
|
---|
[14] | 14 | checkInstanceValid $1
|
---|
[9] | 15 |
|
---|
| 16 | res=$(isRunning $1)
|
---|
| 17 | if [ $res -eq 1 ]; then
|
---|
[14] | 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..."
|
---|
[11] | 32 | start-stop-daemon --stop --pidfile $(getInstancePath $1)/7dtd.pid
|
---|
| 33 | fi
|
---|
[9] | 34 | rm $(getInstancePath $1)/7dtd.pid
|
---|
| 35 | echo "Done"
|
---|
| 36 | exit 0
|
---|
| 37 | else
|
---|
| 38 | echo "7dtd instance $1 is NOT running"
|
---|
| 39 | exit 1
|
---|
| 40 | fi
|
---|
Note:
See
TracBrowser
for help on using the repository browser.