Cfengine 3 example win_schedule.html

######################################################################### # # scheduling.cf - Command Execution Scheduling # # NOTE: Commands can be executed based on any class expression. # Examples include execution of other commands (sequencing), # time, OS, hostname or the outcome of another promise. # If a shell wrapper is not needed, removing it will increase # security and performance. # ######################################################################### bundle agent system_scheduling { vars: # Command definitions are given in cmd[index]. # The dependencies of the commands are dep_cmd[index], as boolean class expressions. # Comments are given as comment_cmd[index] "cmd[1]" string => "$(sys.cf_key)"; "dep_cmd[1]" string => "cmd2_success"; "comment_cmd[1]" string => "Check that a Cfengine key is generated if command 2 has run (dummy)"; windows:: "cmd[2]" string => "\"$(sys.winsysdir)\shutdown.exe\" /r /c \"Cfengine automatic restart\" /t 120"; "dep_cmd[2]" string => "Monday.Hr05.Min00_05"; "comment_cmd[2]" string => "Restart windows every week"; "cmd[3]" string => "$(sys.winsysdir)\cscript.exe \"$(sys.workdir)\script1.vbs\" //Nologo > \"$(sys.workdir)\script1_out.txt\""; "dep_cmd[3]" string => "Hr05.Min05_10"; "comment_cmd[3]" string => "Run a script and save its output for later reference (needs to be run in shell)"; !windows:: "cmd[2]" string => "/bin/echo Hello World!"; "dep_cmd[2]" string => "Hr12.Min00_05"; "comment_cmd[2]" string => "Print a message (dummy)"; any:: "cmd_index" slist => getindices("cmd"); commands: # Runs a command if its dependencies are satisfied "$(cmd[$(cmd_index)])" classes => if_repaired("cmd$(cmd_index)_success"), ifvarclass => "$(dep_cmd[$(cmd_index)])", contain => in_shell, comment => "$(comment_cmd[$(cmd_index)])"; }