summaryrefslogtreecommitdiff
path: root/herculeswrapper/map.sh
blob: d0cd9297ea41883fd6dc291a9b6700e398046e9d (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/env bash

export PIPE=./log/mappipe.tmp
export LOGIN_PIPE=./log/loginpipe.tmp
export CHAR_PIPE=./log/charpipe.tmp

source ${dir}/include.sh

create_pipe

while [ 1 ] ; do
    $DEBUG_MAP ./map-server
    export ret=$?
    case "${ret}" in
    0)
        echo "Returned 0. Probably ctrl+c"
        break
        ;;
    1)
        echo "Returned 1. Probably error in server"
        [ ! -z "$DEBUG_MAP" ] || break
        ;;
    100)
        echo "Terminating server"
        send_all_pipes "exit"
        break
        ;;
    101)
        echo "Restarting all servers..."
        send_all_pipes "restart"
        sleep 5s
        ;;
    102)
        echo "Restarting chat and map servers..."
        send_char_pipe "restart"
        sleep 3s
        ;;
    103)
        echo "Restarting map server..."
        ;;
    104)
        echo "git pull..."
        pull_all
        echo "Restarting all servers..."
        send_all_pipes "restart"
        sleep 5s
        ;;
    105)
        echo "Build all servers"
        sleep 5s
        build_all
        echo "Restarting all servers..."
        send_all_pipes "restart"
        sleep 5s
        ;;
    106)
        echo "Rebuild all servers"
        sleep 5s
        build_clean
        build_all
        echo "Restarting all servers..."
        send_all_pipes "restart"
        sleep 5s
        ;;
    107)
        echo "git pull..."
        pull_all
        echo "Build all servers"
        build_all
        echo "Restarting all servers..."
        send_all_pipes "restart"
        sleep 5s
        ;;
    108)
        echo "git pull..."
        pull_all
        echo "Rebuild all servers"
        build_clean
        build_all
        echo "Restarting all servers..."
        send_all_pipes "restart"
        sleep 5s
        ;;
    109)
        echo "Build plugin"
        sleep 5s
        build_plugin
        echo "Restarting all servers..."
        send_all_pipes "restart"
        sleep 5s
        ;;
    110)
        echo "git pull..."
        pull_all
        echo "Build plugin"
        build_plugin
        echo "Restarting all servers..."
        send_all_pipes "restart"
        sleep 5s
        ;;
    esac
done