Say you do not want crond to run when /mnt filesystem is not mounted.
LOGIC
Is /mnt filesystem is mounted?
YES
Ensure File resource created
Notify crond service ( assuming cron service is defined)
NO
Do not do anything
LOGIC
Is /mnt filesystem is mounted?
YES
Ensure File resource created
Notify crond service ( assuming cron service is defined)
NO
Do not do anything
CODE
exec {
'/bin/echo’:
onlyif => '/bin/cat /proc/mounts | /bin/grep -q \' /mnt \'',
require => File[‘cron_file'];
}
file { 'cron_file':
'/etc/cron.d/custom_crontab':
ensure => file,
source => 'puppet:///$module/$sub_module/custom_crontab',
notify => Service[crond],
owner => 'root',
group => 'root',
mode => '0644';
}
Refer : this discussion
No comments:
Post a Comment