Puppet Advanced Guide--cron Resources detailed

Source: Internet
Author: User

Cron Resources

Cron resources are primarily used to manage the operating system's scheduled tasks (that is, crontab).


1, cron resources commonly used properties


Cron {' Resource title ':

Command

Ensure

Environment

Hour

Minute

Mouth

MonthDay

Weekday

Name

Provider

User

}


command:crontab The command to execute, because of an environment variable, it is recommended to use an absolute path when invoking a command, or to specify the environment property of a cron resource.

Ensure: Specifies whether the resource is enabled, the present value is set to Enabled, and the absent value is set to OFF, the default present.

Environment: Specify environment variables in the crontab environment.

Hour: Run crontab hours, can be set to 0~23, the unit is the hour.

minute: Run crontab minutes, can be set to 0~59, Unit is minutes.

Month: The months that run crontab can be set to 1~12, which is the month.

MonthDay: The day of January, can be set to 1-31, the unit is the day.

Weekday: The number of weeks running crontab, can be set to 0~7, the unit is days.

Name:crontab's comments.

provider: The default value is the Crontab program that comes with the system.

User: Add Crontab to a system account, which is added by default to the system account that is participating in the execution daemon.


2 cases


Use cron resource settings to call ntpdate every 5 minutes to adjust system time and edit/etc/puppet/manifests/cron.pp.

Cron {' ntpdate ':

ensure = present,

Command = '/usr/sbin/ntpdate 192.168.0.1 ',

user = ' root ',

minute = ' */5 ',

}


# Puppet Apply Cron.pp

NOTICE:/stage[main]//cron[ntpdate]/ensure:created

notice:finished catalog run in 0.05 seconds


See if you have added a good

# crontab-u Root-l

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/71/8F/wKiom1XUCK_z49mcAAFG0JDosWI220.jpg "title=" Qq20150819123951.jpg "alt=" Wkiom1xuck_z49mcaafg0jdoswi220.jpg "/>



please pay attention to http://www.wzlinux.com:45 and http://www.wzlinux.com .



This article is from the "Small Drops Linux" blog, make sure to keep this source http://wangzan18.blog.51cto.com/8021085/1685879

Puppet Advanced Guide--cron Resources detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.