diff --git a/manifests/cron.pp b/manifests/cron.pp new file mode 100644 index 0000000..c5262d1 --- /dev/null +++ b/manifests/cron.pp @@ -0,0 +1,29 @@ +# Copyright 2015 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# = Class: bandersnatch::cron +# +# Class to set up bandersnatch cron job. +# +class bandersnatch::cron ( + $user = 'root', +) { + + cron { 'bandersnatch': + user => $user, + minute => '*/5', + command => 'flock -n /var/run/bandersnatch/mirror.lock timeout -k 2m 30m run-bandersnatch >>/var/log/bandersnatch/mirror.log 2>&1', + environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin', + } +} diff --git a/manifests/mirror.pp b/manifests/mirror.pp index 08353be..a9d5d50 100644 --- a/manifests/mirror.pp +++ b/manifests/mirror.pp @@ -48,11 +48,4 @@ class bandersnatch::mirror ( ensure => present, content => template('bandersnatch/bandersnatch.conf.erb'), } - - cron { 'bandersnatch': - user => $user, - minute => '*/5', - command => 'flock -n /var/run/bandersnatch/mirror.lock timeout -k 2m 30m run-bandersnatch >>/var/log/bandersnatch/mirror.log 2>&1', - environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin', - } }