各种笔记
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 line
4.2 KiB

  1. 文件命名为
  2. application_Name.app
  3. 格式如下:
  4. {application,"app名字",
  5. [
  6. {description,"app描述"},
  7. {vsn ,"版本号"},
  8. {id ,Id},%%app id 同 erl -id ID
  9. {modules,[Modules]},%%app包含的模块,systools模块使用它来生成script、tar文件
  10. {maxP,Num},%%进程最大值
  11. {maxT,Time},%%app运行时间 单位毫秒
  12. {registered,[mod]},%%指定app 名字模块,systools用来解决名字冲突
  13. {included_applictions ,[XX]},%%指定子 app,只加载,但是不启动
  14. {applictions,[xxxx]},%%启动自己的app前,appliation:ensure_all_started将会首先启动此列表的app application:start会检查该列表是否都启动
  15. {env,[xxxx]},%%配置app的env,可以使用application:get_env(AppName, Key)获取
  16. {mod,{xxx,args}},%%指定app启动模块,参数,对应自己app的application behavior
  17. {start_phases,[{xxx,xxx}]]%%指定启动阶段一些操作,对应otp application start_phase函数
  18. ]
  19. }
  20. 必须要配置的为description,vsn,modules,registered,applications。
  21. Application为应用名,
  22. descripttion为应用的简单描述
  23. id 产品标识
  24. vsn 应用版本
  25. modules 应用所涉及到的module
  26. registered 注册进程
  27. applications 本应用启动时需要事先启动的其他应用
  28. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  29. erlang官网说明
  30. {application, Application,
  31. [{description, Description},
  32. {id, Id},
  33. {vsn, Vsn},
  34. {modules, Modules}, 本应用程序引入的所有模块。systools 在生成启动脚本和tar文件时使用这个列表。一个模块只能在一个应用程序中定义
  35. {maxP, MaxP}, 已经弃用了
  36. {maxT, MaxT}, 时间单位为毫秒
  37. {registered, Names}, 注册过程的所有名称均在此应用程序中启动。systools使用这个列表来检测不同应用程序之间的名字冲突
  38. {included_applications, Apps}, 此应用程序包含的所有应用程序 当此应用程序启动时,应用程序控制器会自动加载所有包含的应用程序,但不会启动。假设包含应用程序的最高管理者由本应用程序的主管启动
  39. {applications, Apps}, 允许启动此应用程序之前必须启动的所有应用程序。systools使用这个列表来生成正确的启动脚本。缺省为空列表,但请注意所有应用程序对(至少)Kernel和STDLIB都有依赖关系
  40. {env, Env}, 应用程序使用的配置参数。通过调用application:get_env / 1,2来检索配置参数的值
  41. {mod, Start}, 指定应用程序回调模块和启动参数
  42. 对于作为监督树实施的应用程序,密钥mod是必需的,否则应用程序控制器不知道如何启动它。 对于没有进程的应用程序(通常是代码库,例如STDLIB),可以省略mod
  43. {start_phases, Phases},
  44. {runtime_dependencies, RTDeps}]}. 应用程序依赖的应用程序版本列表
  45. Value Default
  46. ----- -------
  47. Application atom() -
  48. Description string() ""
  49. Id string() ""
  50. Vsn string() ""
  51. Modules [Module] []
  52. MaxP int() infinity
  53. MaxT int() infinity
  54. Names [Name] []
  55. Apps [App] []
  56. Env [{Par,Val}] []
  57. Start {Module,StartArgs} []
  58. Phases [{Phase,PhaseArgs}] undefined
  59. RTDeps [ApplicationVersion] []
  60. Module = Name = App = Par = Phase = atom()
  61. Val = StartArgs = PhaseArgs = term()
  62. ApplicationVersion = string()
  63. 如果要使用systools中的函数 需要设置下面的key参数
  64. description vsn modules registered applications
  65. 其他的key被systools忽略
  66. 应用的策略
  67. application:start(Name, Type)
  68. type:
  69. • permanent: if the app terminates, the entire system is taken down, excluding manual termination of the app with application:stop/1.
  70. • transient: if the app terminates for reason normal, that’s ok. Any other reason for termination shuts down the entire system.
  71. • temporary: the application is allowed to stop for any reason. It will be reported, but nothing bad will happen.