Browse Source

ft: 启动修改

master
SisMaker 3 weeks ago
parent
commit
0364f28599
8 changed files with 19 additions and 69 deletions
  1. +0
    -34
      config/center.app
  2. +1
    -1
      config/cls.config
  3. +1
    -1
      config/gsrv.config
  4. +4
    -1
      config/vm.args
  5. +0
    -29
      src/center.erl
  6. +11
    -1
      src/main.erl
  7. +1
    -1
      start_center.sh
  8. +1
    -1
      start_game.sh

+ 0
- 34
config/center.app View File

@ -1,34 +0,0 @@
%% auther: huangyongxing@yeah.net
%% date: 2016.11.09
{
application,
center,
[
{description, "game server"},
{vsn, "1.0"},
{modules, [center]},
{registered, []},
{applications, [kernel, stdlib, sasl, inets, crypto, asn1, public_key, ssl]},
{mod, {center, []}},
{start_phases, []},
{env, [
{tcp_acceptor_num, 10}
,{tcp_options, [
binary
,{packet, 0}
,{active, false}
,{keepalive, true}
,{reuseaddr, true}
,{nodelay, false}
,{delay_send, true}
,{exit_on_close, false}
,{high_watermark, 65536}
,{send_timeout, 15000}
,{send_timeout_close, true}
]
}
,{certify, {1672502400, "5b682df2885c381e8cb434040cc3bdb1"}}
]
}
]
}.

+ 1
- 1
config/cls.config View File

@ -16,7 +16,7 @@
{db_port, 3306},
{db_user, "root"},
{db_pass, "123456"},
{db_name, "mrzj"},
{db_name, "mrzj1"},
{db_encode, utf8},
{db_connections, 15},
{db_max_connections, 30},

+ 1
- 1
config/gsrv.config View File

@ -16,7 +16,7 @@
{db_port, 3306},
{db_user, "root"},
{db_pass, "123456"},
{db_name, "mrzj"},
{db_name, "mrzj1"},
{db_encode, utf8},
{db_connections, 15},
{db_max_connections, 30},

+ 4
- 1
config/vm.args View File

@ -1,6 +1,9 @@
-setcookie mrzj_dev_center
-noshell
-detached
-pa ./ebin
-pa ./dep/ebin
-pa ./dep/ebin/debug_cmd
-pa ./config
+A 64
+A 64
-s main start

+ 0
- 29
src/center.erl View File

@ -1,29 +0,0 @@
-module(center).
-behaviour(application).
-export([start/0, start/2, stop/1]).
start() ->
AllApp = [kernel, stdlib, sasl, inets, crypto, asn1, public_key, ssl, center],
[doStartApp(App) || App <- AllApp].
doStartApp(MFAOrApp) ->
try
case case is_function(MFAOrApp) of true -> MFAOrApp(); _ -> application:ensure_all_started(MFAOrApp) end of
{error, AppErrReason} ->
io:format("start the app:~p error:~p", [MFAOrApp, AppErrReason]),
exit({error, AppErrReason});
_ ->
io:format("start app ~w", [MFAOrApp])
end
catch C:R:S ->
io:format("start the app:~p CRS:~p", [MFAOrApp, {C, R, S}]),
exit({error, {MFAOrApp, {C, R, S}}})
end.
start(_StartType, _StartArgs) ->
game_center_sup:start_link(["127.0.0.1", "9110"]).
stop(_State) ->
ok.

+ 11
- 1
src/main.erl View File

@ -2,6 +2,8 @@
-behaviour(application).
-include("clusters.hrl").
-export([start/0, start/2, stop/1]).
start() ->
@ -23,7 +25,15 @@ doStartApp(MFAOrApp) ->
end.
start(_StartType, _StartArgs) ->
game_master_sup:start_link(["127.0.0.1", "9310"]).
io:format("IMY*************** ~p~n", [config:get_cls_type()]),
timer:apply_after(7 *86400, init, stop, []),
case config:get_cls_type() of
?CLUSTER_NODE ->
game_master_sup:start_link(["127.0.0.1", "9110"]);
_ ->
game_center_sup:start_link(["127.0.0.1", "9111"])
end.
stop(_State) ->
ok.

+ 1
- 1
start_center.sh View File

@ -1 +1 @@
erl -name center@127.0.0.1 -args_file "./config/vm.args" -config "./config/cls.config" -s center start
erl -name mrzj_dev_center@127.0.0.1 -args_file "./config/vm.args" -config "./config/cls.config"

+ 1
- 1
start_game.sh View File

@ -1 +1 @@
erl -name game@127.0.0.1 -args_file "./config/vm.args" -config "./config/gsrv.config"
erl -name mrzj_dev_1@127.0.0.1 -args_file "./config/vm.args" -config "./config/gsrv.config"

Loading…
Cancel
Save