Puppet: System Administration Automated

Support

Ticket #707 (reopened defect)

Opened 1 year ago

Last modified 7 months ago

"special" / @reboot argument doesn't work for cron

Reported by: ask Assigned to: luke
Priority: normal Milestone: misspiggy
Component: cron Version: 0.24.1
Severity: normal Keywords: cron
Cc: Triage Stage: Accepted
Attached Patches: None Complexity: Unknown

Description (Last modified by luke)

In past versions I could use

   cron { ypbot_httpd:
          command => ". ~/.bash_profile; ~/ypbot/combust/bin/run_httpd",
          user => "ypprod",
          special => "reboot",
        }

to make a cron entry like

@reboot . ~/.bash_profile; ~/ypbot/combust/bin/run_httpd

in 0.23.0 it broke and now puppet ends up adding the same line over and over again, but with * * * * * instead of "@reboot".

Running puppetd --test says

"err: Could not prefetch "NilClass"rovider crontab: undefined method `each' for nil:NilClass"
notice: //base/standard/prod-server/ypbot_app/Cron[ypbot_httpd]/ensure: created
notice: //base/standard/prod-server/ypbot_app/Cron[ypbot_svscan]/ensure: created

and sure enough, it adds the wrong line again:

# crontab -l -u ypprod
# HEADER This file was autogenerated at Tue Jul 03 12:13:12 -0700 2007 by puppet.
# HEADER While it can still be managed manually, it is definitely notrecommended.
# HEADER Note particularly that the comments starting with 'Puppet Name' should
# HEADER not be deleted, as doing so could cause duplicate cron jobs.
@reboot . ~/.bash_profile; ~/ypbot/bin/svscan/boot &
@reboot . ~/.bash_profile; ~/ypbot/combust/bin/run_httpd
# Puppet Name: ypbot_httpd
* * * * * . ~/.bash_profile; ~/ypbot/combust/bin/run_httpd
# Puppet Name: ypbot_svscan
* * * * * . ~/.bash_profile; ~/ypbot/bin/svscan/boot &
# Puppet Name: ypbot_httpd
* * * * * . ~/.bash_profile; ~/ypbot/combust/bin/run_httpd
# Puppet Name: ypbot_svscan
* * * * * . ~/.bash_profile; ~/ypbot/bin/svscan/boot &

I noticed it's documented to only work on FreeBSD. It does work with vixie-cron too though.

Change History

07/03/07 21:16:35 changed by luke

  • description changed.
  • stage changed from Unreviewed to Accepted.

11/24/07 04:16:36 changed by luke

  • milestone set to misspiggy.

11/28/07 00:34:10 changed by luke

  • status changed from new to closed.
  • resolution set to fixed.

This should already work in 0.23.2. Please reopen the ticket if it's still broken.

03/20/08 00:26:31 changed by ask

  • version changed from 0.23.0 to 0.24.1.

This seems to either still be an issue or be a new issue again with 0.24.1:

This rule:

   cron { ypbot_svscan:
          command => "sleep 30; . ~/.bash_profile; ~/ypbot/bin/svscan/boot &",
          user => "ypprod",
          special => "reboot",
        }

ends up as this crontab:

# Puppet Name: ypbot_svscan
* * * * * sleep 30; . ~/.bash_profile; ~/ypbot/bin/svscan/boot &

03/20/08 00:30:41 changed by jamtur01

  • status changed from closed to reopened.
  • resolution deleted.

04/24/08 06:56:34 changed by luke

  • component changed from library to cron.