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

Support log rotate by init.d command. 3.0.60

This commit is contained in:
winlin 2019-10-07 17:44:25 +08:00
parent e045b0a619
commit 8ca7f7e5a4
3 changed files with 20 additions and 2 deletions

View file

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