pax_global_header 0000666 0000000 0000000 00000000064 15163421554 0014520 g ustar 00root root 0000000 0000000 52 comment=24a022e93dd17d8325c0b418f052a2019b84f06e
LICENSE 0000664 0000000 0000000 00000002455 15163421554 0012077 0 ustar 00root root 0000000 0000000 BSD 2-Clause License
Copyright (c) 2025, Rocky Enterprise Software Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
README.md 0000664 0000000 0000000 00000004004 15163421554 0012341 0 ustar 00root root 0000000 0000000 ---
title: Sparky Anacron Test
tested_with: 9
ai_contributors:
- tool: Claude Code (Anthropic)
role: Test generation from approved plan
human_author: azaidi
---
# Sparky Anacron test
This test was generated with AI assistance using the Sparky Test Generator Toolkit.
The human contributor is the author and is fully accountable for this contribution.
Verify anacron commands and usage from Rocky Linux documentation using Sparky.
## Documentation
## Documentation findings
| Finding | Doc line | Test resolution |
|---------|----------|-----------------|
| Doc never shows installing `cronie-anacron` -- package required for all commands | Pre-30 | Added as prerequisite: `sudo dnf install cronie-anacron -y` |
| Doc never shows starting `crond.service` -- needed for journalctl output | Pre-79 | Added as prerequisite: `sudo systemctl start crond.service` |
| `shell >` prompt prefix in code blocks -- standard convention but could confuse beginners | 30, 48, 70, 79 | Stripped for test execution |
| `journalctl` output is from author's system (2021-10-20) -- environment-specific | 80-89 | Validated by exit code, not output content |
| Related command options (`-f`, `-u`, `-T`) only in prose table, no code examples | 107-114 | Test exercises `-T` and `-u` as infrastructure commands |
| User use section describes script placement but has no code example | 94-104 | Test creates and executes a test script via `run-parts` |
## Commands not executed
| Command | Reason |
|---------|--------|
| `anacron -f` | Described in prose table (line 111). Forces all jobs but respects configured delays (5 minutes per anacrontab). Execution mechanism tested via `run-parts` instead. |
## Report example
```console
[task check]
stdout match (s) True
stdout match (s) True
stdout match (s) True
stdout match (s) True
stdout match (s) <0hourly ok> True
stdout match (s) True
stdout match (s) True
```
doc-fixes.md 0000664 0000000 0000000 00000006141 15163421554 0013271 0 ustar 00root root 0000000 0000000 # Documentation Fix Suggestions: anacron.md
Source: https://docs.rockylinux.org/guides/automation/anacron/
Generated by: Sparky Test Toolkit (AI-assisted)
Date: 2026-04-02
## Commands that should be fixed
Commands that failed or would fail as-written in a clean Rocky Linux VM.
| # | Line | Current command | Suggested fix | Reason |
|---|------|-----------------|---------------|--------|
| -- | -- | -- | -- | -- |
No commands failed as-written. All 4 doc commands are read-only and execute successfully on a system with cronie-anacron installed.
## Doc-level inconsistencies
Patterns where the doc contradicts its own conventions or has gaps.
| # | Pattern | Lines | Observation | Suggested fix |
|---|---------|-------|-------------|---------------|
| 1 | Missing install step | Pre-30 | The first command `rpm -ql cronie-anacron` assumes the package is installed. The doc never shows installing it. A beginner on a minimal Rocky install would need `sudo dnf install cronie-anacron` first. | Add an install command before the first code block: `sudo dnf install cronie-anacron` |
| 2 | Missing service start | Pre-79 | `journalctl -u crond.service` assumes crond is running with log entries. The doc never shows starting the service. | Add `sudo systemctl start crond.service` or note that crond must be running before the journalctl example |
| 3 | No code examples for described options | 107-114 | The "Related commands" table describes `-f`, `-u`, and `-T` options but none are shown in code blocks. Users would benefit from seeing executable examples. | Add code blocks showing `anacron -T` and `anacron -u` usage |
| 4 | User use section has no code example | 94-104 | The section describes placing scripts in `/etc/cron.daily/` and mentions `chmod +x` but provides no actual code example showing how to create and place a script. | Add a code example showing script creation, chmod, and verification |
## Formatting issues
Code block and structural issues found during analysis.
| # | Line | Issue | Suggested fix |
|---|------|-------|---------------|
| 1 | 30, 48, 70, 79 | Code blocks use `shell >` prompt prefix. This is a standard Rocky doc convention but could confuse beginners who might type the prefix literally. | No fix needed -- this is standard convention. Informational only. |
| 2 | 6 | Front matter has `update : 2021-10-20` with a space before the colon | Change to `update: 2021-10-20` (no space before colon) |
## Environment-specific observations (no fix needed)
Values in the doc that are correct but will differ on other machines.
| # | Line | Command/value | Note |
|---|------|---------------|------|
| 1 | 80-89 | `journalctl -u crond.service` output | Log entries show the author's hostname ("li") and dates from 2021-10-20. Output will differ on every system. |
| 2 | 31-42 | `rpm -ql cronie-anacron` output | Build IDs in the output (lines 34-35) are package-version-specific and will differ across installations. |
## Skipped commands (placeholders)
| # | Line | Command | Reason |
|---|------|---------|--------|
| -- | -- | -- | -- |
No placeholder commands found. All commands in the doc use concrete values.
main.raku 0000664 0000000 0000000 00000000076 15163421554 0012677 0 ustar 00root root 0000000 0000000 task-run "tasks/anacron-run";
task-run "tasks/anacron-check";
tasks/ 0000775 0000000 0000000 00000000000 15163421554 0012211 5 ustar 00root root 0000000 0000000 tasks/anacron-check/ 0000775 0000000 0000000 00000000000 15163421554 0014705 5 ustar 00root root 0000000 0000000 tasks/anacron-check/task.bash 0000664 0000000 0000000 00000003164 15163421554 0016512 0 ustar 00root root 0000000 0000000 #!/bin/bash
# Scenario 1: Package installation — key files from rpm -ql output
if [ -f /etc/anacrontab ]; then
echo "anacrontab ok"
else
echo "anacrontab missing"
fi
if [ -f /usr/sbin/anacron ]; then
echo "binary ok"
else
echo "binary missing"
fi
if [ -d /var/spool/anacron ]; then
echo "spool ok"
else
echo "spool missing"
fi
# Scenario 2: anacrontab configuration structure
if grep -q "SHELL=" /etc/anacrontab && \
grep -q "PATH=" /etc/anacrontab && \
grep -q "MAILTO=" /etc/anacrontab && \
grep -q "RANDOM_DELAY=" /etc/anacrontab && \
grep -q "START_HOURS_RANGE=" /etc/anacrontab && \
grep -q "cron.daily" /etc/anacrontab && \
grep -q "cron.weekly" /etc/anacrontab && \
grep -q "cron.monthly" /etc/anacrontab; then
echo "config valid"
else
echo "config incomplete"
fi
# Scenario 3: 0hourly trigger
if grep -q "run-parts /etc/cron.hourly" /etc/cron.d/0hourly; then
echo "0hourly ok"
else
echo "0hourly missing"
fi
# Scenario 6: Timestamp files from anacron -u
if [ -f /var/spool/anacron/cron.daily ] && \
[ -f /var/spool/anacron/cron.weekly ] && \
[ -f /var/spool/anacron/cron.monthly ]; then
echo "timestamps ok"
else
echo "timestamps missing"
fi
# Scenario 7: Test script execution
if [ -x /etc/cron.daily/sparky-anacron-test.sh ] && [ -s /tmp/sparky-anacron-test.log ]; then
echo "executed"
else
if [ ! -x /etc/cron.daily/sparky-anacron-test.sh ]; then
echo "script missing"
elif [ ! -f /tmp/sparky-anacron-test.log ]; then
echo "log not created"
elif [ ! -s /tmp/sparky-anacron-test.log ]; then
echo "log empty"
fi
fi
tasks/anacron-check/task.check 0000664 0000000 0000000 00000000120 15163421554 0016637 0 ustar 00root root 0000000 0000000 anacrontab ok
binary ok
spool ok
config valid
0hourly ok
timestamps ok
executed
tasks/anacron-run/ 0000775 0000000 0000000 00000000000 15163421554 0014434 5 ustar 00root root 0000000 0000000 tasks/anacron-run/task.bash 0000664 0000000 0000000 00000002663 15163421554 0016244 0 ustar 00root root 0000000 0000000 #!/bin/bash
set -e
# DOC: anacron.md — https://docs.rockylinux.org/guides/automation/anacron/
# --- Prerequisites ---
# DOC-FINDING: Doc never shows installing cronie-anacron — package required for all commands
sudo dnf install cronie-anacron -y
# DOC-FINDING: Doc never shows starting crond.service — needed for journalctl output
sudo systemctl start crond.service
# --- Reset for idempotency ---
sudo rm -f /etc/cron.daily/sparky-anacron-test.sh
sudo rm -f /tmp/sparky-anacron-test.log
# --- anacron configuration file, line 30 ---
rpm -ql cronie-anacron
# --- anacron configuration file, line 48 ---
cat /etc/anacrontab
# --- /etc/cron.hourly/, line 70 ---
cat /etc/cron.d/0hourly
# --- /etc/cron.hourly/, line 79 ---
journalctl -u crond.service
# --- Related commands, line 113 (test infrastructure) ---
# Validates the configuration file /etc/anacrontab
anacron -T
# --- Related commands, line 112 (test infrastructure) ---
# Updates timestamps to current time
anacron -u
# --- User use, lines 94-104 (test infrastructure) ---
# Create test script in /etc/cron.daily/ to test script placement and execution
sudo tee /etc/cron.daily/sparky-anacron-test.sh > /dev/null <<'EOF'
#!/bin/bash
echo "anacron test script executed at $(date)" >> /tmp/sparky-anacron-test.log
EOF
sudo chmod +x /etc/cron.daily/sparky-anacron-test.sh
# Test execution mechanism anacron uses
sudo run-parts /etc/cron.daily/
# Allow script output to flush
sleep 2