Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crontab @weekly matcher broken #6518

Open
nvwls opened this issue May 15, 2023 · 0 comments
Open

crontab @weekly matcher broken #6518

nvwls opened this issue May 15, 2023 · 0 comments
Labels
Type: Bug Feature not working as expected

Comments

@nvwls
Copy link
Contributor

nvwls commented May 15, 2023

Describe the problem

According to https://linux.die.net/man/5/crontab

@weekly    :    Run once a week, ie.  "0 0 * * 0".

Inspec's processing of @weekly is broken. hours reports [*] instead of [0]

Possible Solution

diff --git lib/inspec/resources/crontab.rb lib/inspec/resources/crontab.rb
index ff3561d81..c051d469f 100644
--- lib/inspec/resources/crontab.rb
+++ lib/inspec/resources/crontab.rb
@@ -130,7 +130,7 @@ module Inspec::Resources
 
     HOURLY  = { "minute" => "0" }.freeze
     DAILY   = HOURLY  .merge("hour"    => "0").freeze
-    WEEKLY  = HOURLY  .merge("weekday" => "0").freeze
+    WEEKLY  = DAILY   .merge("weekday" => "0").freeze
     MONTHLY = DAILY   .merge("day"     => "1").freeze
     YEARLY  = MONTHLY .merge("month"   => "1").freeze
     REBOOT  = {
@clintoncwolfe clintoncwolfe added the Type: Bug Feature not working as expected label Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants