Commits

Alexey Rakeev committed e4d265c Draft

Added flushlogs target

  • Participants
  • Parent commits 5875230

Comments (0)

Files changed (3)

 	configtest)
 		configtest 1
 		;;
+	flushlogs)
+		log_daemon_msg "Flushing $DESC logs" "$NAME"
+		start-stop-daemon --stop --signal USR1 --quiet --pidfile $PIDFILE
+		RETVAL=$?
+		log_end_msg $RETVAL
+		;;
 	*)
-		echo "Usage: $0 {start|stop|restart|reload|force-reload|status|configtest}" >&2
+		echo "Usage: $0 {start|stop|restart|reload|force-reload|status|configtest|flushlogs}" >&2
 		RETVAL=2
 		;;
 esac
 		configtest 1
 		echo
 		;;
+	flushlogs)
+		stat || exit 7
+		echo -n "Flushing $prog logs: "
+		killproc -p $pidfile $prog -USR1
+		retval=$?
+		echo
+		;;
 	*)
-		echo "Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status|configtest}" >&2
+		echo "Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status|configtest|flushlogs}" >&2
 		retval=2
+		;;
 esac
 
 exit $retval
 /usr/local/nginx/logs/*.log {
-	daily
-	rotate 7
+	weekly
+	rotate 12
 	compress
 	delaycompress
 	notifempty
 	lastaction
-		kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
+		/etc/init.d/nginx flushlogs
 	endscript
 }