Forum: CFEngine Help Subject: Re: CFEngine Help: Re: Define classes if a process is running or not Author: loopx Link to topic: https://cfengine.com/forum/read.php?3,26866,26951#msg-26951
phnakarin Wrote: ------------------------------------------------------- > Sorry that I don't follow the thread from start, > but this is a kind of promise you'd like? > > > processes: > redhat6:: > "rhsmcertd" > process_stop => "/etc/init.d/rhsmcertd > stop", > process_count => anyprocs("job_done"); > > reports: > job_done:: > "WARNING> Service \"rhsmcertd\" is stopped"; > > ... > ... > ... > > body process_count anyprocs(x) > { > match_range => "0,0"; > out_of_range_define => { "$(x)" }; > } > > > The warning should be in /var/cfengine/outputs or > syslog if executed by cf-execd. Also you may use > "report_to_file" to append this line to any files > you want. > https://cfengine.c > om/manuals/cf3-Reference#report_005fto_005ffile-in > -reports > > Cheers, > -- Nakarin Hi, This solution is working too, but I'm trying to hide these line (running with "-I") which are also printed with your solution : !! Process count for 'rhsmcertd' was out of promised range (1 found) I: Report relates to a promise with handle "" I: Made in version 'Based on Community Promises.cf 1.0.0 - 0.4' of '/var/cfengine/inputs//default.cf' near line 72 I: Comment: Check if process 'rhsmcertd' is running ; should be stopped ... Any idea ? _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine