-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159187 from martinetd/logrotate
logrotate service enhancements
- Loading branch information
Showing
8 changed files
with
89 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Test logrotate service works and is enabled by default | ||
|
||
import ./make-test-python.nix ({ pkgs, ...} : rec { | ||
name = "logrotate"; | ||
meta = with pkgs.lib.maintainers; { | ||
maintainers = [ martinetd ]; | ||
}; | ||
|
||
# default machine | ||
machine = { ... }: { | ||
}; | ||
|
||
testScript = | ||
'' | ||
with subtest("whether logrotate works"): | ||
machine.succeed( | ||
# we must rotate once first to create logrotate stamp | ||
"systemctl start --wait logrotate.service", | ||
# wtmp is present in default config. | ||
"rm -f /var/log/wtmp*", | ||
"echo test > /var/log/wtmp", | ||
# move into the future and rotate | ||
"date -s 'now + 1 month + 1 day'", | ||
# systemd will run logrotate from logrotate.timer automatically | ||
# on date change, but if we want to wait for it to terminate | ||
# it's easier to run again... | ||
"systemctl start --wait logrotate.service", | ||
# check rotate worked | ||
"[ -e /var/log/wtmp.1 ]", | ||
) | ||
''; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters