From 9d90a8177f86586da21caf14b077063fe20a9c05 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 4 Oct 2019 20:02:51 +0800 Subject: [PATCH 01/10] Disable SO_REUSEPORT if not supported. 3.0.57 --- README.md | 1 + trunk/src/core/srs_core.hpp | 2 +- trunk/src/service/srs_service_st.cpp | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b13d78ba5..ec9129ea4 100755 --- a/README.md +++ b/README.md @@ -152,6 +152,7 @@ Please select according to languages: ### V3 changes +* v3.0, 2019-10-04, Disable SO_REUSEPORT if not supported. 3.0.57 * v3.0, 2019-10-04, [3.0 alpha0(3.0.56)][r3.0a0] released. 107946 lines. * v3.0, 2019-10-04, Support go-oryx rtmplb with [proxy protocol](https://github.com/ossrs/go-oryx/wiki/RtmpProxy). 3.0.56 * v3.0, 2019-10-03, Fix [#775][bug #775], Support SO_REUSEPORT to improve edge performance. 3.0.54 diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 5f020c54b..fd2797f01 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -27,7 +27,7 @@ // The version config. #define VERSION_MAJOR 3 #define VERSION_MINOR 0 -#define VERSION_REVISION 56 +#define VERSION_REVISION 57 // The macros generated by configure script. #include diff --git a/trunk/src/service/srs_service_st.cpp b/trunk/src/service/srs_service_st.cpp index e4ffe2669..1f6d2266c 100644 --- a/trunk/src/service/srs_service_st.cpp +++ b/trunk/src/service/srs_service_st.cpp @@ -112,10 +112,15 @@ srs_error_t srs_fd_reuseaddr(int fd) srs_error_t srs_fd_reuseport(int fd) { +#if defined(SO_REUSEPORT) int v = 1; if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &v, sizeof(int)) == -1) { return srs_error_new(ERROR_SOCKET_SETREUSEADDR, "SO_REUSEPORT fd=%v", fd); } +#else + #warning "SO_REUSEPORT is not supported by your OS" + srs_warn("SO_REUSEPORT is not supported util Linux kernel 3.9"); +#endif return srs_success; } From d42f0d8ffba91cad048782a16c285a2c50d5211a Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 4 Oct 2019 20:59:35 +0800 Subject: [PATCH 02/10] Remove skype --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ec9129ea4..5c1f2534e 100755 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ [![](https://circleci.com/gh/ossrs/srs/tree/3.0release.svg?style=svg&circle-token=1ef1d5b5b0cde6c8c282ed856a18199f9e8f85a9)](https://circleci.com/gh/ossrs/srs/tree/3.0release) [![](https://codecov.io/gh/ossrs/srs/branch/3.0release/graph/badge.svg)](https://codecov.io/gh/ossrs/srs/branch/3.0release) [![](https://cloud.githubusercontent.com/assets/2777660/22814959/c51cbe72-ef92-11e6-81cc-32b657b285d5.png)](https://github.com/ossrs/srs/wiki/v1_CN_Contact#wechat) -[Skype](https://github.com/ossrs/srs/wiki/v1_EN_Contact#skype-or-gitter) SRS/3.0,[OuXuli][release3],是一个简单的流媒体直播集群,简单的快乐。
SRS is a simple live streaming cluster, a simple joy. From f6fc31db66e7b810fdc5091c1ba6f1ac0aea9280 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 5 Oct 2019 17:02:25 +0800 Subject: [PATCH 03/10] Add config files for go-oryx --- trunk/conf/go-oryx-edge.conf | 15 +++++++++++++++ trunk/conf/go-oryx-edge2.conf | 15 +++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 trunk/conf/go-oryx-edge.conf create mode 100644 trunk/conf/go-oryx-edge2.conf diff --git a/trunk/conf/go-oryx-edge.conf b/trunk/conf/go-oryx-edge.conf new file mode 100644 index 000000000..8b07031e0 --- /dev/null +++ b/trunk/conf/go-oryx-edge.conf @@ -0,0 +1,15 @@ +# the config for srs origin-edge cluster +# @see https://github.com/ossrs/srs/wiki/v1_CN_Edge +# @see full.conf for detail config. + +listen 19351; +max_connections 1000; +pid objs/edge1.pid; +daemon off; +srs_log_tank console; +vhost __defaultVhost__ { + cluster { + mode remote; + origin 127.0.0.1:19350; + } +} diff --git a/trunk/conf/go-oryx-edge2.conf b/trunk/conf/go-oryx-edge2.conf new file mode 100644 index 000000000..74ea54f01 --- /dev/null +++ b/trunk/conf/go-oryx-edge2.conf @@ -0,0 +1,15 @@ +# the config for srs origin-edge cluster +# @see https://github.com/ossrs/srs/wiki/v1_CN_Edge +# @see full.conf for detail config. + +listen 19352; +max_connections 1000; +pid objs/edge2.pid; +daemon off; +srs_log_tank console; +vhost __defaultVhost__ { + cluster { + mode remote; + origin 127.0.0.1:19350; + } +} From 64288d1f1ed1422034e4b3c06355248cd42ecd09 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 5 Oct 2019 20:33:26 +0800 Subject: [PATCH 04/10] Support systemctl service for CentOS7. 3.0.58 --- README.md | 1 + trunk/configure | 22 +++++++++++++++------- trunk/scripts/install.sh | 23 ++++++++++++++++++++--- trunk/src/core/srs_core.hpp | 2 +- trunk/usr/lib/systemd/system/srs.service | 12 ++++++++++++ 5 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 trunk/usr/lib/systemd/system/srs.service diff --git a/README.md b/README.md index 5c1f2534e..118e17db0 100755 --- a/README.md +++ b/README.md @@ -151,6 +151,7 @@ Please select according to languages: ### V3 changes +* v3.0, 2019-10-05, Support systemctl service for CentOS7. 3.0.58 * v3.0, 2019-10-04, Disable SO_REUSEPORT if not supported. 3.0.57 * v3.0, 2019-10-04, [3.0 alpha0(3.0.56)][r3.0a0] released. 107946 lines. * v3.0, 2019-10-04, Support go-oryx rtmplb with [proxy protocol](https://github.com/ossrs/go-oryx/wiki/RtmpProxy). 3.0.56 diff --git a/trunk/configure b/trunk/configure index 301b997f5..e4f75de9b 100755 --- a/trunk/configure +++ b/trunk/configure @@ -484,22 +484,30 @@ install: @mkdir -p \$(__REAL_INSTALL) @echo "Now make the http root dir" @mkdir -p \$(__REAL_INSTALL)/objs/nginx/html - @cp research/api-server/static-dir/crossdomain.xml \$(__REAL_INSTALL)/objs/nginx/html + @cp -f research/api-server/static-dir/crossdomain.xml \$(__REAL_INSTALL)/objs/nginx/html @echo "Now copy binary files" @mkdir -p \$(__REAL_INSTALL)/objs - @cp objs/srs \$(__REAL_INSTALL)/objs + @cp -f objs/srs \$(__REAL_INSTALL)/objs @echo "Now copy srs conf files" @mkdir -p \$(__REAL_INSTALL)/conf - @cp conf/*.conf \$(__REAL_INSTALL)/conf + @cp -f conf/*.conf \$(__REAL_INSTALL)/conf @echo "Now copy init.d script files" @mkdir -p \$(__REAL_INSTALL)/etc/init.d - @cp 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 + @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 "SRS is installed, to link and start srs:" - @echo " sudo ln -sf \$(SRS_PREFIX)/etc/init.d/srs /etc/init.d/srs" + @echo "The api installed, to link and start srs, please" + @echo "For CentOS6:" + @echo " sudo ln -sf \$(SRS_PREFIX)/etc/init.d/srs /etc/init.d/srs &&" @echo " /etc/init.d/srs start" - @echo "@see: https://github.com/ossrs/srs/wiki/v1_CN_LinuxService" + @echo "For CentOS7:" + @echo " sudo ln -sf \$(SRS_PREFIX)/etc/init.d/srs /etc/init.d/srs &&" + @echo " sudo cp -f \$(SRS_PREFIX)/usr/lib/systemd/system/srs.service /usr/lib/systemd/system/srs.service && sudo systemctl daemon-reload && sudo systemctl enable srs &&" + @echo " sudo systemctl start srs" + @echo "@see: https://github.com/ossrs/srs/wiki/v3_CN_LinuxService" END fi diff --git a/trunk/scripts/install.sh b/trunk/scripts/install.sh index faa35bffc..2d725d8a5 100755 --- a/trunk/scripts/install.sh +++ b/trunk/scripts/install.sh @@ -83,6 +83,17 @@ ok_msg "install init.d scripts" ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install init.d scripts failed"; exit $ret; fi ok_msg "install init.d scripts success" +# For systemctl +if [[ -d /usr/lib/systemd/system ]]; then + ok_msg "install srs.service for systemctl" + ( + cp -f $install_root/usr/lib/systemd/system/srs.service /usr/lib/systemd/system/srs.service && + systemctl daemon-reload + ) >>$log 2>&1 + ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install srs.service for systemctl failed"; exit $ret; fi + ok_msg "install srs.service for systemctl success" +fi + # install system service lsb_release --id|grep "CentOS" >/dev/null 2>&1; os_id_centos=$? lsb_release --id|grep "Ubuntu" >/dev/null 2>&1; os_id_ubuntu=$? @@ -90,7 +101,11 @@ lsb_release --id|grep "Debian" >/dev/null 2>&1; os_id_debian=$? lsb_release --id|grep "Raspbian" >/dev/null 2>&1; os_id_rasabian=$? if [[ 0 -eq $os_id_centos ]]; then ok_msg "install system service for CentOS" - /sbin/chkconfig --add srs && /sbin/chkconfig srs on + if [[ -d /usr/lib/systemd/system ]]; then + systemctl enable srs + else + /sbin/chkconfig --add srs && /sbin/chkconfig srs on + fi ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install system service failed"; exit $ret; fi ok_msg "install system service success" elif [[ 0 -eq $os_id_ubuntu ]]; then @@ -113,9 +128,11 @@ else fi echo "" -echo "see: https://github.com/ossrs/srs/wiki/v1_CN_LinuxService" -echo "install success, you can:" +echo "see: https://github.com/ossrs/srs/wiki/v3_CN_LinuxService" +echo "install success, you can start SRS on CentOS6:" echo -e "${GREEN} sudo /etc/init.d/srs start${BLACK}" +echo "or CentOS7:" +echo -e "${GREEN} sudo systemctl start srs${BLACK}" echo "srs root is ${INSTALL}" exit 0 diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index fd2797f01..8ae0953a5 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -27,7 +27,7 @@ // The version config. #define VERSION_MAJOR 3 #define VERSION_MINOR 0 -#define VERSION_REVISION 57 +#define VERSION_REVISION 58 // The macros generated by configure script. #include diff --git a/trunk/usr/lib/systemd/system/srs.service b/trunk/usr/lib/systemd/system/srs.service new file mode 100644 index 000000000..b76bc930a --- /dev/null +++ b/trunk/usr/lib/systemd/system/srs.service @@ -0,0 +1,12 @@ +[Unit] +Description=The SRS Media Stream Cluster +After=network.target + +[Service] +Type=forking +ExecStart=/etc/init.d/srs start +ExecReload=/etc/init.d/srs reload +ExecStop=/etc/init.d/srs stop + +[Install] +WantedBy=multi-user.target From 5d9bc0658ea2105a6ba800874e18784787048e55 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 5 Oct 2019 20:37:25 +0800 Subject: [PATCH 05/10] Fix package bug --- trunk/scripts/package.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trunk/scripts/package.sh b/trunk/scripts/package.sh index c72624fb1..6629bbf6e 100755 --- a/trunk/scripts/package.sh +++ b/trunk/scripts/package.sh @@ -87,7 +87,9 @@ ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "lsb_release not found. " failed_msg "to install on centos/debian(ubuntu/respberry-pi):"; failed_msg " sudo yum install -y lsb-release"; - failed_msg " sudo aptitude install -y lsb-release"; + failed_msg " sudo aptitude install -y lsb-release"; + failed_msg "or centos7:" + failed_msg " sudo yum install -y redhat-lsb" exit $ret; fi From 254549e3f4469df85063fa2d80a8b225354bd052 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 5 Oct 2019 20:40:45 +0800 Subject: [PATCH 06/10] Add uninstall script --- trunk/scripts/unstall.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 trunk/scripts/unstall.sh diff --git a/trunk/scripts/unstall.sh b/trunk/scripts/unstall.sh new file mode 100755 index 000000000..685dc82b8 --- /dev/null +++ b/trunk/scripts/unstall.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +systemctl disable srs +systemctl stop srs +rm -rf /usr/local/srs +rm -f /etc/init.d/srs +echo "SRS uninstalled" From 7af087652f969b504d59d93c07874198e68c2a7b Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 5 Oct 2019 20:43:04 +0800 Subject: [PATCH 07/10] Add uninstall script --- trunk/scripts/unstall.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/trunk/scripts/unstall.sh b/trunk/scripts/unstall.sh index 685dc82b8..d65809bb7 100755 --- a/trunk/scripts/unstall.sh +++ b/trunk/scripts/unstall.sh @@ -1,7 +1,15 @@ #!/bin/bash -systemctl disable srs -systemctl stop srs +if [[ -d /usr/lib/systemd/system ]]; then + systemctl disable srs + systemctl stop srs + rm -f /usr/lib/systemd/system/srs.service + rm -f /etc/init.d/srs +else + /sbin/chkconfig srs off + /sbin/chkconfig --del srs + /etc/init.d/srs stop + rm -f /etc/init.d/srs +fi rm -rf /usr/local/srs -rm -f /etc/init.d/srs echo "SRS uninstalled" From b0227e0d22a0c530d05634fcbf5ffef6c8407b1a Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 5 Oct 2019 20:46:44 +0800 Subject: [PATCH 08/10] Fix bug for package script --- trunk/scripts/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/trunk/scripts/install.sh b/trunk/scripts/install.sh index 2d725d8a5..3a1c6292a 100755 --- a/trunk/scripts/install.sh +++ b/trunk/scripts/install.sh @@ -69,6 +69,7 @@ ok_msg "copy core components" mkdir -p $install_root cp -r $work_dir/${INSTALL}/conf $install_root && cp -r $work_dir/${INSTALL}/etc $install_root && + cp -r $work_dir/${INSTALL}/usr $install_root && cp -r $work_dir/${INSTALL}/objs $install_root ) >>$log 2>&1 ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "copy core components failed"; exit $ret; fi From e045b0a6191ee096b18290c4d1f9773da31a0724 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 7 Oct 2019 10:34:55 +0800 Subject: [PATCH 09/10] We prefer ipv4, only use ipv6 if ipv4 is disabled. 3.0.59 --- README.md | 1 + trunk/src/app/srs_app_rtsp.cpp | 2 +- trunk/src/app/srs_app_server.cpp | 7 +++--- trunk/src/core/srs_core.hpp | 2 +- trunk/src/kernel/srs_kernel_utility.cpp | 31 +++++++++++++++++-------- trunk/src/kernel/srs_kernel_utility.hpp | 3 ++- trunk/src/utest/srs_utest_kernel.cpp | 2 +- 7 files changed, 30 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 118e17db0..ceebbbf54 100755 --- a/README.md +++ b/README.md @@ -151,6 +151,7 @@ Please select according to languages: ### V3 changes +* v3.0, 2019-10-06, We prefer ipv4, only use ipv6 if ipv4 is disabled. 3.0.59 * v3.0, 2019-10-05, Support systemctl service for CentOS7. 3.0.58 * v3.0, 2019-10-04, Disable SO_REUSEPORT if not supported. 3.0.57 * v3.0, 2019-10-04, [3.0 alpha0(3.0.56)][r3.0a0] released. 107946 lines. diff --git a/trunk/src/app/srs_app_rtsp.cpp b/trunk/src/app/srs_app_rtsp.cpp index 35fffa620..b96b2190e 100644 --- a/trunk/src/app/srs_app_rtsp.cpp +++ b/trunk/src/app/srs_app_rtsp.cpp @@ -52,7 +52,7 @@ SrsRtpConn::SrsRtpConn(SrsRtspConn* r, int p, int sid) _port = p; stream_id = sid; // TODO: support listen at <[ip:]port> - listener = new SrsUdpListener(this, srs_any_address4listener(), p); + listener = new SrsUdpListener(this, srs_any_address_for_listener(), p); cache = new SrsRtpPacket(); pprint = SrsPithyPrint::create_caster(); } diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 1901da4db..33f571d32 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -1017,9 +1017,8 @@ srs_error_t SrsServer::listen_rtmp() for (int i = 0; i < (int)ip_ports.size(); i++) { SrsListener* listener = new SrsBufferListener(this, SrsListenerRtmpStream); listeners.push_back(listener); - - std::string ip; - int port; + + int port; string ip; srs_parse_endpoint(ip_ports[i], ip, port); if ((err = listener->listen(ip, port)) != srs_success) { @@ -1113,7 +1112,7 @@ srs_error_t SrsServer::listen_stream_caster() } // TODO: support listen at <[ip:]port> - if ((err = listener->listen(srs_any_address4listener(), port)) != srs_success) { + if ((err = listener->listen(srs_any_address_for_listener(), port)) != srs_success) { return srs_error_wrap(err, "listen at %d", port); } } diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 8ae0953a5..1753f1708 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -27,7 +27,7 @@ // The version config. #define VERSION_MAJOR 3 #define VERSION_MINOR 0 -#define VERSION_REVISION 58 +#define VERSION_REVISION 59 // The macros generated by configure script. #include diff --git a/trunk/src/kernel/srs_kernel_utility.cpp b/trunk/src/kernel/srs_kernel_utility.cpp index d0f19d86c..93ea6a895 100644 --- a/trunk/src/kernel/srs_kernel_utility.cpp +++ b/trunk/src/kernel/srs_kernel_utility.cpp @@ -210,18 +210,29 @@ void srs_parse_hostport(const string& hostport, string& host, int& port) } } -string srs_any_address4listener() +string srs_any_address_for_listener() { - int fd = socket(AF_INET6, SOCK_DGRAM, 0); - - // socket() - // A -1 is returned if an error occurs, otherwise the return value is a - // descriptor referencing the socket. - if(fd != -1) { - close(fd); + bool ipv4_active = false; + bool ipv6_active = false; + + if (true) { + int fd = socket(AF_INET, SOCK_DGRAM, 0); + if(fd != -1) { + ipv4_active = true; + close(fd); + } + } + if (true) { + int fd = socket(AF_INET6, SOCK_DGRAM, 0); + if(fd != -1) { + ipv6_active = true; + close(fd); + } + } + + if (ipv6_active && !ipv4_active) { return "::"; } - return "0.0.0.0"; } @@ -240,7 +251,7 @@ void srs_parse_endpoint(string hostport, string& ip, int& port) const string sport = hostport.substr(pos + 1); port = ::atoi(sport.c_str()); } else { - ip = srs_any_address4listener(); + ip = srs_any_address_for_listener(); port = ::atoi(hostport.c_str()); } } diff --git a/trunk/src/kernel/srs_kernel_utility.hpp b/trunk/src/kernel/srs_kernel_utility.hpp index 99a3fdc6a..3b55a520f 100644 --- a/trunk/src/kernel/srs_kernel_utility.hpp +++ b/trunk/src/kernel/srs_kernel_utility.hpp @@ -48,7 +48,8 @@ extern srs_utime_t srs_get_system_startup_time(); extern srs_utime_t srs_update_system_time(); // The "ANY" address to listen, it's "0.0.0.0" for ipv4, and "::" for ipv6. -extern std::string srs_any_address4listener(); +// @remark We prefer ipv4, only use ipv6 if ipv4 is disabled. +extern std::string srs_any_address_for_listener(); // The dns resolve utility, return the resolved ip address. extern std::string srs_dns_resolve(std::string host, int& family); diff --git a/trunk/src/utest/srs_utest_kernel.cpp b/trunk/src/utest/srs_utest_kernel.cpp index 2e4e0960c..7f0479ddb 100644 --- a/trunk/src/utest/srs_utest_kernel.cpp +++ b/trunk/src/utest/srs_utest_kernel.cpp @@ -4086,7 +4086,7 @@ VOID TEST(KernelUtilityTest, CoverTimeUtilityAll) } if (true) { - string ep = srs_any_address4listener(); + string ep = srs_any_address_for_listener(); EXPECT_TRUE(ep == "0.0.0.0" || ep == "::"); } From 8ca7f7e5a4f0cc84d46855d9fae13d15fa847bf9 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 7 Oct 2019 17:44:25 +0800 Subject: [PATCH 10/10] Support log rotate by init.d command. 3.0.60 --- README.md | 1 + trunk/etc/init.d/srs | 19 ++++++++++++++++++- trunk/src/core/srs_core.hpp | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ceebbbf54..e9ed60dc2 100755 --- a/README.md +++ b/README.md @@ -151,6 +151,7 @@ Please select according to languages: ### V3 changes +* v3.0, 2019-10-06, Support log rotate by init.d command. 3.0.60 * v3.0, 2019-10-06, We prefer ipv4, only use ipv6 if ipv4 is disabled. 3.0.59 * v3.0, 2019-10-05, Support systemctl service for CentOS7. 3.0.58 * v3.0, 2019-10-04, Disable SO_REUSEPORT if not supported. 3.0.57 diff --git a/trunk/etc/init.d/srs b/trunk/etc/init.d/srs index 2c0e92e71..7e749044d 100755 --- a/trunk/etc/init.d/srs +++ b/trunk/etc/init.d/srs @@ -166,6 +166,18 @@ reload() { return 0 } +logrotate() { + # not start, exit + load_process_info + if [[ 0 -ne $? ]]; then failed_msg "SRS not start."; return 0; fi + + ok_msg "Reopen log file of SRS(pid ${srs_pid})..." + kill -s SIGUSR1 ${srs_pid} + + ok_msg "Log rotated" + return 0 +} + menu() { case "$1" in start) @@ -184,8 +196,13 @@ menu() { reload) reload ;; + rotate) + logrotate + ;; *) - echo "Usage: $0 {start|stop|status|restart|reload}" + echo "Usage: $0 {start|stop|status|restart|reload|rotate}" + echo " reload Apply log file by not restarting SRS" + echo " rotate For log rotate, to send SIGUSR1 to SRS to reopen the log file." return 1 ;; esac diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 1753f1708..3dd549262 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -27,7 +27,7 @@ // The version config. #define VERSION_MAJOR 3 #define VERSION_MINOR 0 -#define VERSION_REVISION 59 +#define VERSION_REVISION 60 // The macros generated by configure script. #include