9.6. Sample Time Based Expressions


The following command configures an expression that is true if now is any time in the year 2005.
Copy to Clipboard Toggle word wrap
# pcs constraint location Webserver rule score=INFINITY date-spec years=2005 
The following command configures an expression that is true from 9am to 5pm, Monday through Friday. Note that the hours value of 16 matches up to 16:59:59, as the numeric value (hour) still matches.
Copy to Clipboard Toggle word wrap
# pcs constraint location Webserver rule score=INFINITY date-spec hours="9-16" weekdays="1-5"
The following command configures an expression that is true when there is a full moon on Friday the 13th.
Copy to Clipboard Toggle word wrap
# pcs constraint location Webserver rule date-spec weekdays=5 monthdays=13 moon=4
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat, Inc.