Bug#529224: Cron job removal

2010-08-02 Thread Stig Sandbeck Mathisen
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



Bug#529224: Cron job removal

2010-08-01 Thread Jayen
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.

The crontab looks like:
# HEADER: This file was autogenerated at Thu Oct 02 17:39:56 +1000 2008
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
# check open ports every 15mins
1-60/15 * * * * /usr/local/sbin/portcheck
# check logs every 10mins ie. to clear old hacks
1-60/10 * * * * /usr/local/sbin/logsucker


On 01/08/10 04:32, Stig Sandbeck Mathisen wrote:
 
 Do you have a copy of the crontab, including comments?  The puppet cron
 provider uses comments to identify the presence of the cron jobs it
 handles.
 
 Was this cron job created by puppet, or by someone/something else?  Did
 someone edit the crontab afterwards?
 

-- 
Jayen Ashar

PhD Student (AI), UNSW
Linux SysAdmin, UNSW '09
MIT (Autonomous Systems), UNSW '08
Verification Engineer, IBM '07
ECE+CS+robotics+languages, CMU '02



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#529224: Cron job removal

2010-07-31 Thread Stig Sandbeck Mathisen

Do you have a copy of the crontab, including comments?  The puppet cron
provider uses comments to identify the presence of the cron jobs it
handles.

Was this cron job created by puppet, or by someone/something else?  Did
someone edit the crontab afterwards?

-- 
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