File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -430,6 +430,35 @@ install_apache_deb() {
430430 systemd restart apache2
431431}
432432
433+ configure_logrotate () {
434+ msg " info" " Configuring logrotate for SupportPal logs..."
435+
436+ install logrotate
437+
438+ LOGROTATE_CONFIG=" /etc/logrotate.d/supportpal"
439+ backup " $LOGROTATE_CONFIG "
440+
441+ echo " ${log_path} /*.log {
442+ daily
443+ missingok
444+ rotate 14
445+ compress
446+ delaycompress
447+ notifempty
448+ create 0640 $( if [[ $os_type == ' rhel' ]]; then echo " apache apache" ; else echo " www-data www-data" ; fi)
449+ sharedscripts
450+ postrotate
451+ if [[ $os_type == 'rhel' ]]; then
452+ /bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
453+ else
454+ /usr/sbin/invoke-rc.d apache2 reload > /dev/null 2>&1 || true
455+ fi
456+ endscript
457+ }" > " $LOGROTATE_CONFIG "
458+
459+ msg " info" " Logrotate configuration created at $LOGROTATE_CONFIG "
460+ }
461+
433462install_apache () {
434463 msg " info" " Configuring Apache2..."
435464
@@ -441,6 +470,8 @@ install_apache() {
441470 install_apache_deb
442471 fi
443472
473+ configure_logrotate
474+
444475 install_php
445476}
446477
You can’t perform that action at this time.
0 commit comments