summaryrefslogtreecommitdiff
path: root/athena.sh
blob: 51fe8b24a4737a315411d540c519fcbbacd20b32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash

# $Id$
#----------------------------------------------------------------------
# Description: eAthena dameon control script.
# Author: Zuzanna K. Filutowska <platyna@platinum.linux.pl>
# Created at: Fri Feb 17 18:23:56 CET 2006
# License: GPL
# Copyright (c) 2006 Zuzanna K. Filutowska  All rights reserved.
#
#----------------------------------------------------------------------
# Configure section:
PATH=$PATH:.
SRVHOMEDIR=$HOME/tmwserver
#----------------------------------------------------------------------
# main()

cd ${SRVHOMEDIR}

athena_start() {
    if [ -x ${SRVHOMEDIR}/login-server ]; 
	then echo "Starting login server..."
	     ${SRVHOMEDIR}/login-server > ${SRVHOMEDIR}/log/login-server-startup.log 2>&1 &
	else echo "Login server binary is not executable or not found."
    fi
    
    if [ -x ${SRVHOMEDIR}/char-server ]; 
	then echo "Starting char server..."
	     ${SRVHOMEDIR}/char-server > ${SRVHOMEDIR}/log/char-server-startup.log 2>&1 &
	else echo "Character server binary is not executable or not found."
    fi

    if [ -x ${SRVHOMEDIR}/map-server ]; 
	then echo "Starting map server..."
	     ${SRVHOMEDIR}/map-server > ${SRVHOMEDIR}/log/map-server-startup.log 2>&1 &
	else
	    echo "Map server binary is not executable or not found."
    fi
}

athena_stop() {
    echo "Shutting down login server..."
    killall login-server
    echo "Shutting down char server..."
    killall char-server
    echo "Shutting down map server..."
    killall map-server
}

athena_restart() {
    athena_stop
    echo "Waiting for all processes to end..."
    sleep 10
    athena_start
}

case "$1" in
'start')
  athena_start
  ;;
'stop')
  athena_stop
  ;;
'restart')
  athena_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac