[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Exec a script to determine further action based on return code.
From: |
rader |
Subject: |
Re: Exec a script to determine further action based on return code. |
Date: |
Fri, 24 Jun 2005 09:11:32 -0500 |
> Brian E. Seppanen wrote:
> I have an action that I need to perform on a regular basis, and the
> means of determining if the update should be done requires an SQL
> query. I can write a script that will return 1 or 0 to define a
> variable, but how do I provide the feedback to cfengine based on the
> return code as to whether the action should be performed or not...
>
> Any ideas appreciated?
use a module? here's the general idea, albeit untested...
steve
- - -
systems & network manager
high energy physics
university of wisconsin
bash$ sudo cat /var/cfengine/inputs/cfagent.conf
[...]
control:
addinstallable = ( sql_query_is_true )
moduledirectory = ( /var/cfengine/modules )
actionsequence = ( module:SomeSqlQuery ... )
[...]
shellcommands:
sql_query_is_true::
"/bin/echo the sql query is true"
[...]
bash$ sudo cat /var/cfengine/modules/module:SomeSqlQuery
#!/bin/sh
sql_query_is_true() {
# if query is okay, then
# success... return 0
# else
# failure... return 1
# fi
}
if sql_query_is_true ; then
echo +sql_query_is_true
fi