mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Fix #1352, fix typo of daemon.
This commit is contained in:
parent
ffe391aa49
commit
5d8fb01b45
6 changed files with 18 additions and 18 deletions
|
@ -54,7 +54,7 @@ start() {
|
||||||
ok_msg "Starting SRS-api..."
|
ok_msg "Starting SRS-api..."
|
||||||
# TODO: FIXME: set limit by, for instance, "ulimit -HSn 10000"
|
# TODO: FIXME: set limit by, for instance, "ulimit -HSn 10000"
|
||||||
# TODO: FIXME: write log to, for instance, the same dir of log.
|
# TODO: FIXME: write log to, for instance, the same dir of log.
|
||||||
# TODO: FIXME: support deamon, without nohup.
|
# TODO: FIXME: support daemon, without nohup.
|
||||||
(cd ${ROOT}; nohup ${APP} ${CONFIG} >/dev/null 2>&1 &)
|
(cd ${ROOT}; nohup ${APP} ${CONFIG} >/dev/null 2>&1 &)
|
||||||
|
|
||||||
# check again after start server
|
# check again after start server
|
||||||
|
|
|
@ -3890,7 +3890,7 @@ srs_error_t SrsConfig::check_normal_config()
|
||||||
}
|
}
|
||||||
|
|
||||||
// asprocess conflict with daemon
|
// asprocess conflict with daemon
|
||||||
if (get_asprocess() && get_deamon()) {
|
if (get_asprocess() && get_daemon()) {
|
||||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "daemon conflicts with asprocess");
|
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "daemon conflicts with asprocess");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3990,7 +3990,7 @@ string SrsConfig::argv()
|
||||||
return _argv;
|
return _argv;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SrsConfig::get_deamon()
|
bool SrsConfig::get_daemon()
|
||||||
{
|
{
|
||||||
SrsConfDirective* conf = root->get("daemon");
|
SrsConfDirective* conf = root->get("daemon");
|
||||||
if (!conf || conf->arg0().empty()) {
|
if (!conf || conf->arg0().empty()) {
|
||||||
|
|
|
@ -406,10 +406,10 @@ public:
|
||||||
// The root directive, no name and args, contains directives.
|
// The root directive, no name and args, contains directives.
|
||||||
// All directive parsed can retrieve from root.
|
// All directive parsed can retrieve from root.
|
||||||
virtual SrsConfDirective* get_root();
|
virtual SrsConfDirective* get_root();
|
||||||
// Get the deamon config.
|
// Get the daemon config.
|
||||||
// If true, SRS will run in deamon mode, fork and fork to reap the
|
// If true, SRS will run in daemon mode, fork and fork to reap the
|
||||||
// grand-child process to init process.
|
// grand-child process to init process.
|
||||||
virtual bool get_deamon();
|
virtual bool get_daemon();
|
||||||
// Get the max connections limit of system.
|
// Get the max connections limit of system.
|
||||||
// If exceed the max connection, SRS will disconnect the connection.
|
// If exceed the max connection, SRS will disconnect the connection.
|
||||||
// @remark, linux will limit the connections of each process,
|
// @remark, linux will limit the connections of each process,
|
||||||
|
|
|
@ -902,7 +902,7 @@ srs_error_t SrsServer::do_cycle()
|
||||||
// for asprocess.
|
// for asprocess.
|
||||||
bool asprocess = _srs_config->get_asprocess();
|
bool asprocess = _srs_config->get_asprocess();
|
||||||
|
|
||||||
// the deamon thread, update the time cache
|
// the daemon thread, update the time cache
|
||||||
// TODO: FIXME: use SrsHourGlass.
|
// TODO: FIXME: use SrsHourGlass.
|
||||||
while (true) {
|
while (true) {
|
||||||
if (handler && (err = handler->on_cycle()) != srs_success) {
|
if (handler && (err = handler->on_cycle()) != srs_success) {
|
||||||
|
|
|
@ -89,7 +89,7 @@ public:
|
||||||
|
|
||||||
// Get system rusage, use cache to avoid performance problem.
|
// Get system rusage, use cache to avoid performance problem.
|
||||||
extern SrsRusage* srs_get_system_rusage();
|
extern SrsRusage* srs_get_system_rusage();
|
||||||
// The deamon st-thread will update it.
|
// The daemon st-thread will update it.
|
||||||
extern void srs_update_system_rusage();
|
extern void srs_update_system_rusage();
|
||||||
|
|
||||||
// To stat the process info.
|
// To stat the process info.
|
||||||
|
@ -339,7 +339,7 @@ public:
|
||||||
extern SrsProcSelfStat* srs_get_self_proc_stat();
|
extern SrsProcSelfStat* srs_get_self_proc_stat();
|
||||||
// Get system cpu stat, use cache to avoid performance problem.
|
// Get system cpu stat, use cache to avoid performance problem.
|
||||||
extern SrsProcSystemStat* srs_get_system_proc_stat();
|
extern SrsProcSystemStat* srs_get_system_proc_stat();
|
||||||
// The deamon st-thread will update it.
|
// The daemon st-thread will update it.
|
||||||
extern void srs_update_proc_stat();
|
extern void srs_update_proc_stat();
|
||||||
|
|
||||||
// Stat disk iops
|
// Stat disk iops
|
||||||
|
@ -446,7 +446,7 @@ public:
|
||||||
|
|
||||||
// Get disk stat, use cache to avoid performance problem.
|
// Get disk stat, use cache to avoid performance problem.
|
||||||
extern SrsDiskStat* srs_get_disk_stat();
|
extern SrsDiskStat* srs_get_disk_stat();
|
||||||
// The deamon st-thread will update it.
|
// The daemon st-thread will update it.
|
||||||
extern void srs_update_disk_stat();
|
extern void srs_update_disk_stat();
|
||||||
|
|
||||||
// Stat system memory info
|
// Stat system memory info
|
||||||
|
@ -487,7 +487,7 @@ public:
|
||||||
|
|
||||||
// Get system meminfo, use cache to avoid performance problem.
|
// Get system meminfo, use cache to avoid performance problem.
|
||||||
extern SrsMemInfo* srs_get_meminfo();
|
extern SrsMemInfo* srs_get_meminfo();
|
||||||
// The deamon st-thread will update it.
|
// The daemon st-thread will update it.
|
||||||
extern void srs_update_meminfo();
|
extern void srs_update_meminfo();
|
||||||
|
|
||||||
// system cpu hardware info.
|
// system cpu hardware info.
|
||||||
|
@ -543,7 +543,7 @@ public:
|
||||||
|
|
||||||
// Get platform info, use cache to avoid performance problem.
|
// Get platform info, use cache to avoid performance problem.
|
||||||
extern SrsPlatformInfo* srs_get_platform_info();
|
extern SrsPlatformInfo* srs_get_platform_info();
|
||||||
// The deamon st-thread will update it.
|
// The daemon st-thread will update it.
|
||||||
extern void srs_update_platform_info();
|
extern void srs_update_platform_info();
|
||||||
|
|
||||||
// The network device summary for each network device, for example, eth0, eth1, ethN
|
// The network device summary for each network device, for example, eth0, eth1, ethN
|
||||||
|
@ -586,7 +586,7 @@ public:
|
||||||
// Get network devices info, use cache to avoid performance problem.
|
// Get network devices info, use cache to avoid performance problem.
|
||||||
extern SrsNetworkDevices* srs_get_network_devices();
|
extern SrsNetworkDevices* srs_get_network_devices();
|
||||||
extern int srs_get_network_devices_count();
|
extern int srs_get_network_devices_count();
|
||||||
// The deamon st-thread will update it.
|
// The daemon st-thread will update it.
|
||||||
extern void srs_update_network_devices();
|
extern void srs_update_network_devices();
|
||||||
|
|
||||||
// The system connections, and srs rtmp network summary
|
// The system connections, and srs rtmp network summary
|
||||||
|
@ -629,7 +629,7 @@ public:
|
||||||
|
|
||||||
// Get network devices info, use cache to avoid performance problem.
|
// Get network devices info, use cache to avoid performance problem.
|
||||||
extern SrsNetworkRtmpServer* srs_get_network_rtmp_server();
|
extern SrsNetworkRtmpServer* srs_get_network_rtmp_server();
|
||||||
// The deamon st-thread will update it.
|
// The daemon st-thread will update it.
|
||||||
extern void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps);
|
extern void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps);
|
||||||
|
|
||||||
// Get local or peer ip.
|
// Get local or peer ip.
|
||||||
|
|
|
@ -378,15 +378,15 @@ srs_error_t run(SrsServer* svr)
|
||||||
return srs_error_wrap(err, "server initialize");
|
return srs_error_wrap(err, "server initialize");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not deamon, directly run master.
|
// If not daemon, directly run master.
|
||||||
if (!_srs_config->get_deamon()) {
|
if (!_srs_config->get_daemon()) {
|
||||||
if ((err = run_master(svr)) != srs_success) {
|
if ((err = run_master(svr)) != srs_success) {
|
||||||
return srs_error_wrap(err, "run master");
|
return srs_error_wrap(err, "run master");
|
||||||
}
|
}
|
||||||
return srs_success;
|
return srs_success;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_trace("start deamon mode...");
|
srs_trace("start daemon mode...");
|
||||||
|
|
||||||
int pid = fork();
|
int pid = fork();
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ srs_error_t run(SrsServer* svr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// son
|
// son
|
||||||
srs_trace("son(deamon) process running.");
|
srs_trace("son(daemon) process running.");
|
||||||
|
|
||||||
if ((err = run_master(svr)) != srs_success) {
|
if ((err = run_master(svr)) != srs_success) {
|
||||||
return srs_error_wrap(err, "daemon run master");
|
return srs_error_wrap(err, "daemon run master");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue