From 6a5bc27f9bca885969997e4b4fffec79ca2f69b3 Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 13 Jan 2022 15:16:54 +0800 Subject: [PATCH] Support configure with --config as default config file. v4.0.227 --- trunk/conf/lighthouse.conf | 5 ++ trunk/configure | 4 +- trunk/doc/CHANGELOG.md | 2 +- trunk/etc/init.d/srs-api | 127 --------------------------- trunk/scripts/install.sh | 2 +- trunk/src/core/srs_core_version4.hpp | 2 +- 6 files changed, 11 insertions(+), 131 deletions(-) delete mode 100755 trunk/etc/init.d/srs-api diff --git a/trunk/conf/lighthouse.conf b/trunk/conf/lighthouse.conf index 61e5ba5b0..fd363e350 100644 --- a/trunk/conf/lighthouse.conf +++ b/trunk/conf/lighthouse.conf @@ -4,6 +4,11 @@ max_connections 1000; daemon on; srs_log_tank file; +# For LightHouse VM to run SRS, never enable docker. +in_docker off; +disable_daemon_for_docker off; +auto_reload_for_docker off; + http_server { enabled on; listen 8080; diff --git a/trunk/configure b/trunk/configure index be64ac9bf..5c28041be 100755 --- a/trunk/configure +++ b/trunk/configure @@ -463,6 +463,7 @@ CXXFLAGS = ${CXXFLAGS} # install prefix. SRS_PREFIX=${SRS_PREFIX} +SRS_DEFAULT_CONFIG=${SRS_DEFAULT_CONFIG} __REAL_INSTALL=\$(DESTDIR)\$(SRS_PREFIX) default: server @@ -609,11 +610,12 @@ install: @mkdir -p \$(__REAL_INSTALL)/etc/init.d @cp -f etc/init.d/srs \$(__REAL_INSTALL)/etc/init.d @sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs + @sed -i "s|^CONFIG=.*|CONFIG=\"\$(SRS_DEFAULT_CONFIG)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs @echo "Now copy systemctl service files" @mkdir -p \$(__REAL_INSTALL)/usr/lib/systemd/system @cp -f usr/lib/systemd/system/srs.service \$(__REAL_INSTALL)/usr/lib/systemd/system/srs.service @echo "" - @echo "@see: https://github.com/ossrs/srs/wiki/v3_CN_LinuxService" + @echo "@see: https://github.com/ossrs/srs/wiki/v4_CN_LinuxService" END diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 1d13b8e55..db13e5838 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,8 +8,8 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2022-01-13, Support configure with --config as default config file. v4.0.227 * v4.0, 2022-01-13, For [#2880](https://github.com/ossrs/srs/pull/2880): Add SrsAutoFreeH to release ptr with hooks. (#2880). v4.0.226 -* v4.0, 2022-01-13, Support api_port to specify the WebRTC API port. v4.0.226 * v4.0, 2022-01-13, Support api_port to specify the WebRTC API port. v4.0.224 * v4.0, 2022-01-13, Merge [#2873](https://github.com/ossrs/srs/pull/2873): LiveSource: Refine fetch for external exposed interface. (#2873). v4.0.223 * v4.0, 2022-01-13, Add conf/lighthouse.conf for LightHouse. v4.0.222 diff --git a/trunk/etc/init.d/srs-api b/trunk/etc/init.d/srs-api deleted file mode 100755 index 64e5413c7..000000000 --- a/trunk/etc/init.d/srs-api +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/bash - -### BEGIN INIT INFO -# Provides: ossrs-api(srs-api) -# Required-Start: $all -# Required-Stop: $all -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: ossrs-api(srs-api) -# Description: https://github.com/ossrs/srs -### END INIT INFO - -# the config of ROOT, user must modify it when start srs from other directory, -# it's ok to use the script by command ./etc/init.d/ossrs -ROOT="./" -APP="python ./research/api-server/server.py" -CONFIG="8085" - -######################################################################## -# utility functions -######################################################################## -RED="\\033[31m" -GREEN="\\033[32m" -YELLOW="\\033[33m" -BLACK="\\033[0m" -POS="\\033[60G" - -ok_msg(){ - echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]" -} - -failed_msg(){ - echo -e "${1}${POS}${BLACK}[${RED}FAILED${BLACK}]" -} - -# load process info of srs-api -# @set variable $srs_api_id to the process id. -# @return 0, if process exists; otherwise: -# 1, for srs-api not exists. -# @set variable $error_msg if error. -load_process_info() { - srs_api_id=`ps aux|grep python|grep research|grep "api-server"|awk '{print $2}'` - if [[ -z $srs_api_id ]]; then error_msg="srs-api process does not exists"; return 1; fi - - return 0; -} - -start() { - # if exists, exit. - load_process_info - if [[ 0 -eq $? ]]; then failed_msg "SRS-api started(pid ${srs_api_id}), should not start it again."; return 0; fi - - # not exists, start server - ok_msg "Starting SRS-api..." - # TODO: FIXME: set limit by, for instance, "ulimit -HSn 10000" - # TODO: FIXME: write log to, for instance, the same dir of log. - # TODO: FIXME: support daemon, without nohup. - (cd ${ROOT}; nohup ${APP} ${CONFIG} >/dev/null 2>&1 &) - - # check again after start server - load_process_info - ret=$?; if [[ 0 -eq $? ]]; then ok_msg "SRS-api started(pid ${srs_api_id})"; return 0; fi - - failed_msg "SRS-api not started" - return $ret -} - -stop() { - # not start, exit - load_process_info - if [[ 0 -ne $? ]]; then failed_msg "SRS-api not start."; return 0; fi - - ok_msg "Stopping SRS-api(pid ${srs_api_id})..." - - # process exists, kill util stop - for((;;)); do - load_process_info - if [[ 0 -eq $? ]]; then - kill -s SIGKILL ${srs_api_id} 2>/dev/null - ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "send signal SIGKILL failed ret=$ret"; return $ret; fi - sleep 0.1 - else - ok_msg "SRS-api stopped" - break; - fi - done - - sleep 0.1 - return 0 -} - -# get the status of srs-api process -# @return 0 if srs-api is running; otherwise, 1 for stopped. -status() { - load_process_info - ret=$?; if [[ 0 -eq $ret ]]; then echo "SRS-api(pid ${srs_api_id}) is running."; return 0; fi - - echo "SRS-api is stopped" - return 1 -} - -menu() { - case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - status) - status - ;; - *) - echo "Usage: $0 {start|stop|status|restart}" - return 1 - ;; - esac -} - -menu $1 - -code=$? -exit ${code} diff --git a/trunk/scripts/install.sh b/trunk/scripts/install.sh index 6f161b13f..416c6537d 100755 --- a/trunk/scripts/install.sh +++ b/trunk/scripts/install.sh @@ -129,7 +129,7 @@ else fi echo "" -echo "see: https://github.com/ossrs/srs/wiki/v3_CN_LinuxService" +echo "see: https://github.com/ossrs/srs/wiki/v4_CN_LinuxService" echo "install success, you can start SRS on CentOS6:" echo -e "${GREEN} sudo /etc/init.d/srs start${BLACK}" echo "or CentOS7:" diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 32ef05add..d3c84788e 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 226 +#define VERSION_REVISION 227 #endif