Periodic
This article is a stub, please help us extending it with more detailed information.
Built-in Commands
Periodic commes with some built-in commands for usage in tasks files
system.exec
This command is a simple shell executor. Just write you shell command in to the command tag
<command type="system.exec">echo "Hello World"</command>
fs.copy
The fs.copy command has 3 arguments. These are "src", "dst" and the optional "depth". The "src" parameter is as you may think the source for the copy action. In "dst" the destination of the copy action is defined. With the optional "depth" parameter you can define how many levels you want to copy. The Value of 1 means copy only file/folder itself, 2 means if src is a folder copy the folder and the files it contains and the folders it contains but without thier content.
<command type="fs.copy">
<src>/var/www/uploads/</src>
<dst>/var/backup/uploads/</dst>
<depth>2</depth>
</command>
fs.remove
"fs.remove" will be used to remove files and folder. There are 2 parameters called "path" and "pattern" which is optional. The "path" parameter defines the file/folder which should be removed. If the "pattern" parameter is given and path is a folder then not the folder itself will be deleted but all files in this folder which match the given pattern.
<command type="fs.remove">
<path>/var/www/uploads/tmp/</path>
<pattern>*.jpg</pattern>
</command>
Add own Commands
To add own commands to Periodic you had to do mainly 2 things. First write a class that extends from "periodicCommand" and implements the "run()" method. The Second step is to register you class with a command name.
periodicCommandRegistry::registerCommand("commandname","classname");
Now you can use your own command in periodic tasks
<command type="commandname">echo "Hello World"</command>