[Notes (edited slightly) issued with the release of PIKT 1.19.0pre4, which: added the doexec Pikt script statement.]
When using the pikt '-T' (Test) command-line switch, or if the alarm status is set to 'testing', alarm 'exec' and 'exec wait' statements become effectively 'output' (or 'output mail'), and command strings are reported and/or logged rather than executed. But what about the following situation?
dmesg_scan(BYPASSES) init status =piktstatus level =piktlevel task "Scan the dmesg output for troublesome or noteworthy entries" input proc "if [ -e =hstdir/log/dmesg=piktalert=_.bak ]; then =diff =hstdir/log/dmesg=piktalert=_.bak =hstdir/log/dmesg=piktalert | =egrep '>' | =cut -b 3- 2>/dev/null; else =cat =hstdir/log/dmesg=piktalert 2>/dev/null; fi" begin exec wait "=dmesg | =uniq > =hstdir/log/dmesg=piktalert" rule [... input processing follows ...]
In the 'begin' section 'exec' statement, the intent is to send dmesg output to a file, which is then used as script input in the 'input proc' statement. In testing mode, the 'exec' would in fact not execute, there would be no saved dmesg output, and the script would be rendered useless.
To fix this, we have added a new script statement, 'doexec', to force command execution in all cases. If instead you have
doexec wait "=dmesg | =uniq > =hstdir/log/dmesg=piktalert"
the dmesg output will be written to the file whether or not the script is in testing mode.
So, use 'doexec' where essential to the script operation and ordinary 'exec' where the indicated command execution is optional (or for safety's sake during the script development and testing phase you want a command to be reported rather than executed).
For more examples, see Developer's Notes.