mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
Run logrotation binary from program
This commit is contained in:
parent
fae848bd1b
commit
b7b150a979
@ -201,9 +201,29 @@ const setupCertbotPlugins = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a timer to call run the logrotation binary every two days
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
const setupLogrotation = () => {
|
||||||
|
const intervalTimeout = 1000 * 60 * 60 * 24 * 2; // 2 days
|
||||||
|
|
||||||
|
const runLogrotate = async () => {
|
||||||
|
await utils.exec('logrotate -f /etc/logrotate.d/nginx-proxy-manager');
|
||||||
|
logger.info('Logrotate completed.');
|
||||||
|
};
|
||||||
|
|
||||||
|
logger.info('Logrotate Timer initialized');
|
||||||
|
setInterval(runLogrotate, intervalTimeout);
|
||||||
|
// And do this now as well
|
||||||
|
return runLogrotate();
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
return setupJwt()
|
return setupJwt()
|
||||||
.then(setupDefaultUser)
|
.then(setupDefaultUser)
|
||||||
.then(setupDefaultSettings)
|
.then(setupDefaultSettings)
|
||||||
.then(setupCertbotPlugins);
|
.then(setupCertbotPlugins)
|
||||||
|
.then(setupLogrotation);
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/data/logs/*_access.log /data/logs/*/*_access.log {
|
/data/logs/*_access.log /data/logs/*/access.log {
|
||||||
create 0644 root root
|
create 0644 root root
|
||||||
weekly
|
weekly
|
||||||
rotate 4
|
rotate 4
|
||||||
@ -11,7 +11,7 @@
|
|||||||
endscript
|
endscript
|
||||||
}
|
}
|
||||||
|
|
||||||
/data/logs/*_error.log /data/logs/*/*_error.log {
|
/data/logs/*_error.log /data/logs/*/error.log {
|
||||||
create 0644 root root
|
create 0644 root root
|
||||||
weekly
|
weekly
|
||||||
rotate 10
|
rotate 10
|
||||||
@ -22,17 +22,4 @@
|
|||||||
postrotate
|
postrotate
|
||||||
/bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
|
/bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
|
||||||
endscript
|
endscript
|
||||||
}
|
}
|
||||||
|
|
||||||
/data/logs/*.log /data/logs/*[!_error].log /data/logs/*[!_access].log {
|
|
||||||
create 0644 root root
|
|
||||||
weekly
|
|
||||||
rotate 5
|
|
||||||
missingok
|
|
||||||
notifempty
|
|
||||||
compress
|
|
||||||
sharedscripts
|
|
||||||
postrotate
|
|
||||||
/bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
|
|
||||||
endscript
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user