Forum: Cfengine Help
Subject: problem restarting services
Author: cell
Link to topic: https://cfengine.com/forum/read.php?3,18669,18669#msg-18669
Hi,
I've got problem with restarting some services. If the name of service
(/etc/init.d/service) and running process is the same, then everything is
working fine. But when name of service is /etc/init.d/bind9 and running process
is only 'bind', then I don't know how to restart it, because I have name of
services in slist and for every service in slist I look in the process table
and if it's not there then I restart that service.
I am using this code for restarting:
bundle agent restart
{
vars:
"service" slist => { "ssh", "snmpd", "apache2", "bacula-fd",
"denyhosts", };
"daemon_path" string => "/etc/init.d";
processes:
"${service}"
comment => "Counting amount of processes for '${service}'",
process_count => up("${service}");
commands:
"${daemon_path}/${service}"
comment => "Executing command '${daemon_path}/${service}
start'",
ifvarclass => "${service}_up",
args => "restart";
}
body process_count up(s) {
match_range => "0,0";
in_range_define => { "${s}_up" };
ifelapsed => "1";
}
Is there a way to manage it some way? I know other way how to restart those
services, but I don't want to write for every service it's own promise. I would
like to keep it tide like is shown in the code above.
So my question is how to restart services which have different names as their
processes without making special promises for them.
thanks for any suggestions
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine