-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jack C Hong
committed
Dec 4, 2014
1 parent
9150320
commit 3285b2b
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# This extends check_date to ask for resource date repeatedly | ||
# | ||
defProperty('resource', 'foo', 'ID of a resource') | ||
|
||
defGroup('bob', property.resource) | ||
|
||
onEvent(:ALL_UP) do |event| | ||
# Timer is specified in seconds | ||
every 5 do | ||
info '>>> Every 5 secs' | ||
group('bob').exec('/bin/date') | ||
end | ||
|
||
# You can make it clear that it is in seconds | ||
every 7.seconds do | ||
info '>>> Every 7 secs' | ||
group('bob').exec('/bin/date') | ||
end | ||
|
||
# You can use minutes too | ||
every 2.minutes do | ||
info '>>> Every 2 mins' | ||
group('bob').exec('/bin/date') | ||
end | ||
|
||
# It will run for 10 mins | ||
# You could also stop this experiment by sending term signal (ctrl+c) | ||
after 10.minutes do | ||
Experiment.done | ||
end | ||
end | ||
|
||
# Timer can be placed anywhere, | ||
# but normally placing it inside onEvent callback makes more sense | ||
# | ||
after 1.day do | ||
warn 'I suppose you will not wait enough time to see this' | ||
end |