File: reverse3.mcl

package info (click to toggle)
mgmt 0.0.26.git.2024.10.25.85e1d6c0e8-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,364 kB
  • sloc: sh: 2,471; yacc: 1,285; makefile: 543; python: 196; lisp: 77
file content (27 lines) | stat: -rw-r--r-- 628 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import "datetime"
import "math"

$now = datetime.now()

# alternate every four seconds
$mod0 = math.mod($now, 8) == 0
$mod1 = math.mod($now, 8) == 1
$mod2 = math.mod($now, 8) == 2
$mod3 = math.mod($now, 8) == 3
$mod = $mod0 or $mod1 or $mod2 or $mod3

file "/tmp/mgmt/" {
	state => $const.res.file.state.exists,
}

# file should change the mode every four seconds
# editing the file contents at anytime is allowed
# you should create the file before you run this
if $mod {
	file "/tmp/mgmt/hello" {
		#state => $const.res.file.state.exists,	# omit to see it change the mode only!
		mode => "0777",

		Meta:reverse => true,
	}
}