PERL based log analyzer
SourceForge.net Logo
Home Home Contact us Contacts
Overview Documentation Downloads Contacts Links
 
News & Updates
 
July 21, 2008
v 1.0 now available
Quick Links
 
Sourceforge project's page
CeCILL license
CEA web site
External command evaluation next up previous contents
Next: Launching Kazimir Up: Using the variables Previous: using variables within variables   Contents

External command evaluation

In sh, it is very common to use a syntax which looks like

	var=`ls -l | grep mypattern` 	
	echo $var
The fact of being able to replace a command within back quotes by its output is something I wanted to have in kazimir, for making the construction of generic configuration files easier. So I added this feature in kazimir. In any field in which you can use variables, you can use the syntax `cmd` in the same way. For example in a 'Action' tag you can write
Action: Nom = RespawnToto ; Path = /usr/bin/totod `date`;
In this example, this will start the toto service (not an actual one of course) with the current date as argument. If this does not seem clear enough, try this syntax in one of your Kazimir's configuration file. I am sure this will not stay fuzzy for long.

It is important to notice that the syntax with back quotes is authorized within 'Let' statement. An example like this one is perfectly correct:

Variable: Name = x ; Default = `date`

Action: Nom = RespawnToto ; Path = /usr/bin/totod $(x);   Let = { $(x)  <- `date` ;}
And by doing this is this (perfectly stupid) example, you will start the totod service with the date of the last re-spawn (contained in variable $(x) ).


next up previous contents
Next: Launching Kazimir Up: Using the variables Previous: using variables within variables   Contents
Philippe Deniel 2008-07-22
Designed by CMG Technologies, adapted by Thomas LEIBOVICI
Design downloaded from Free Templates