1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Support configure with --config as default config file. v4.0.227

This commit is contained in:
winlin 2022-01-13 15:16:54 +08:00
parent 3881c4c77e
commit 6a5bc27f9b
6 changed files with 11 additions and 131 deletions

View file

@ -4,6 +4,11 @@ max_connections 1000;
daemon on; daemon on;
srs_log_tank file; 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 { http_server {
enabled on; enabled on;
listen 8080; listen 8080;

4
trunk/configure vendored
View file

@ -463,6 +463,7 @@ CXXFLAGS = ${CXXFLAGS}
# install prefix. # install prefix.
SRS_PREFIX=${SRS_PREFIX} SRS_PREFIX=${SRS_PREFIX}
SRS_DEFAULT_CONFIG=${SRS_DEFAULT_CONFIG}
__REAL_INSTALL=\$(DESTDIR)\$(SRS_PREFIX) __REAL_INSTALL=\$(DESTDIR)\$(SRS_PREFIX)
default: server default: server
@ -609,11 +610,12 @@ install:
@mkdir -p \$(__REAL_INSTALL)/etc/init.d @mkdir -p \$(__REAL_INSTALL)/etc/init.d
@cp -f etc/init.d/srs \$(__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|^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" @echo "Now copy systemctl service files"
@mkdir -p \$(__REAL_INSTALL)/usr/lib/systemd/system @mkdir -p \$(__REAL_INSTALL)/usr/lib/systemd/system
@cp -f usr/lib/systemd/system/srs.service \$(__REAL_INSTALL)/usr/lib/systemd/system/srs.service @cp -f usr/lib/systemd/system/srs.service \$(__REAL_INSTALL)/usr/lib/systemd/system/srs.service
@echo "" @echo ""
@echo "@see: https://github.com/ossrs/srs/wiki/v3_CN_LinuxService" @echo "@see: https://github.com/ossrs/srs/wiki/v4_CN_LinuxService"
END END

View file

@ -8,8 +8,8 @@ The changelog for SRS.
## SRS 4.0 Changelog ## 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, 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, 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, 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 * v4.0, 2022-01-13, Add conf/lighthouse.conf for LightHouse. v4.0.222

View file

@ -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}

View file

@ -129,7 +129,7 @@ else
fi fi
echo "" 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 "install success, you can start SRS on CentOS6:"
echo -e "${GREEN} sudo /etc/init.d/srs start${BLACK}" echo -e "${GREEN} sudo /etc/init.d/srs start${BLACK}"
echo "or CentOS7:" echo "or CentOS7:"

View file

@ -9,6 +9,6 @@
#define VERSION_MAJOR 4 #define VERSION_MAJOR 4
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_REVISION 226 #define VERSION_REVISION 227
#endif #endif