Jayen jas...@alumni.cmu.edu writes:
The cron job was not added by puppet, but was around before we started
using puppet. We're trying to clean up some of the old cron jobs
using puppet.
That won't work with puppet's cron provider, unfortunately. It will only
remove cron jobs it identifies as one of its own.
To be more specific: It uses a commented header to identify the cron
job. As you see, the hour and minute does not need to be specified to
remove the cron job:
,[ Existing crontab before puppet ]
| s...@mavis:~ :) $ crontab -l
| # m h dom mon dow command
| 08 08 * * * /home/ssm/bin/update-schroots
`
,[ Add new crontab with puppet ]
| $ puppet -e 'cron{update-schroots: command =
/home/ssm/bin/update-schroots, minute = fqdn_rand(59), hour= fqdn_rand(23),
ensure = present }'
| notice: /Stage[main]//Cron[update-schroots]/ensure: created
| s...@mavis:~ :) $ crontab -l
| # HEADER: This file was autogenerated at Mon Aug 02 11:33:18 +0200 2010 by
puppet.
| # HEADER: While it can still be managed manually, it is definitely not
recommended.
| # HEADER: Note particularly that the comments starting with 'Puppet Name'
should
| # HEADER: not be deleted, as doing so could cause duplicate cron jobs.
| # m h dom mon dow command
| 08 08 * * * /home/ssm/bin/update-schroots
| # Puppet Name: update-schroots
| 25 17 * * * /home/ssm/bin/update-schroots
`
,[ Remove crontab with puppet ]
| s...@mavis:~ :) $ puppet -e 'cron{update-schroots: command =
/home/ssm/bin/update-schroots, ensure = absent }'
| notice: /Stage[main]//Cron[update-schroots]/ensure: removed
| s...@mavis:~ :) $ crontab -l
| # HEADER: This file was autogenerated at Mon Aug 02 11:34:37 +0200 2010 by
puppet.
| # HEADER: While it can still be managed manually, it is definitely not
recommended.
| # HEADER: Note particularly that the comments starting with 'Puppet Name'
should
| # HEADER: not be deleted, as doing so could cause duplicate cron jobs.
| # m h dom mon dow command
| 08 08 * * * /home/ssm/bin/update-schroots
`
,[ Remove crontab with puppet (again) ]
| s...@mavis:~ :) $ puppet -e 'cron{update-schroots: command =
/home/ssm/bin/update-schroots, ensure = absent }'
| s...@mavis:~ :) $ crontab -l
| # HEADER: This file was autogenerated at Mon Aug 02 11:34:37 +0200 2010 by
puppet.
| # HEADER: While it can still be managed manually, it is definitely not
recommended.
| # HEADER: Note particularly that the comments starting with 'Puppet Name'
should
| # HEADER: not be deleted, as doing so could cause duplicate cron jobs.
| # m h dom mon dow command
| 08 08 * * * /home/ssm/bin/update-schroots
`
You could, instead, use a definition to remove a line matching your
commands in the crontab file with a define like the one found at
http://git.black.co.at/?p=module-common;a=blob_plain;f=manifests/defines/line.pp
--
Stig Sandbeck Mathisen
ooo, shiny!
--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org