You could also use something like *flock *(
http://stackoverflow.com/questions/169964/how-to-prevent-a-script-from-running-simultaneously)
to only run some script at a time.

Using flock is not appropriate here as you want 5/10 so managing the locks
number and balancing is an issue, and you would probably create 5 locks.

2016-01-14 11:40 GMT+01:00 Guillaume François <
[email protected]>:

> And what about a different hardcoded sleep in each XX.sh script ?
>
> 2016-01-14 11:37 GMT+01:00 Ferran Mengibar Pastor <
> [email protected]>:
>
>> Hi,
>>
>> I thought about that, but It's not possible :(
>>
>> I have x servers, but every server have a different configuration.
>>
>> For example
>> Server 1 : program 1,10,11,12,13,14,15...
>> Server 2 : program 1,2,3,4,10,11,12,13,14,15...
>> ....
>>
>> And too, I need the output of every check program for generate an
>> automatically alarm with monit.
>>
>> Thanks
>>
>> Ferran
>>
>>
>> 2016-01-14 10:57 GMT+01:00 Tino Hendricks <[email protected]>:
>>
>>> Hello,
>>>
>>> sounds to me like essentially you don’t want synchronous execution. So
>>> why not „concat" all  XX.sh into a single 1_to_25.sh and let it handle it
>>> sequentially?
>>>
>>> Tino
>>> > Am 14.01.2016 um 10:06 schrieb Ferran Mengibar Pastor <
>>> [email protected]>:
>>> >
>>> > Hello,
>>> > I have a problem with the load of my servers and the number of "check
>>> programs" of my monit configuration (5.12.1 v)
>>> >
>>> > In the documentation, we can see:
>>> > Program checks are asynchronous. Meaning that Monit will not wait for
>>> the program to exit, but instead, Monit will start the program in the
>>> background and immediately continue checking the next service entry in
>>> monitrc.
>>> >
>>> > My config file (example):
>>> > set daemon 120
>>> >
>>> > check program 1 with path 1.sh
>>> >   if status = 1 then alert
>>> > check program 2 with path 2.sh
>>> >   if status = 1 then alert
>>> > ......
>>> > check program 24 with path 24.sh
>>> >   if status = 1 then alert
>>> > check program 25 with path 25.sh
>>> >   if status = 1 then alert
>>> >
>>> > Every program takes between 5 and 10 seconds.
>>> >
>>> > The problem is that in less than 1 second I have the machine with all
>>> the programs in state of running .... but with a load average of 30.
>>> >
>>> > Could it be possible to execute all these programs, but limit only
>>> 5/10 running at time?
>>> >
>>> > I mean (I write an example with my config file and with 5 of limit).
>>> > Start : 1, 2, 3, 4, 5
>>> > Run   : 1, 2, 3, 4, 5
>>> > End  : 1 ---> start only the 6
>>> > Run  : 2, 3, 4, 5, 6
>>> > End  : 2 and 3 ---> start 7 and 8
>>> > ...
>>> > Run  : 21,22,23,24,25 (25 is the last one)
>>> > End  : 21
>>> > Run  : 22, 23, 24,25
>>> > End  : 22, 23, 24
>>> > Run  : 25
>>> > End  : 25
>>> >
>>> > Wait 120 seconds for the next iteration
>>> >
>>> > It's possible? Or maybe we have a variable like asynchronousLimit?
>>> >
>>> > Thanks
>>> >
>>> > --
>>> > Ferran Mengibar Pastor
>>> > Delivery Service
>>> >
>>> >
>>> > Tél. : +34 972 982 967
>>> >
>>> > www.augure.com
>>> >
>>> > Blog: Reputation in action
>>> > Skype: dragglori
>>> > Access map: Augure Girona
>>> >
>>> > --
>>> > To unsubscribe:
>>> > https://lists.nongnu.org/mailman/listinfo/monit-general
>>>
>>>
>>> --
>>> To unsubscribe:
>>> https://lists.nongnu.org/mailman/listinfo/monit-general
>>
>>
>>
>>
>> --
>>
>> *Ferran Mengibar Pastor*
>> Delivery Service
>>
>>
>> Tél. : +34 972 982 967
>>
>> *www.augure.com <http://www.augure.com/>*
>>
>> *Blog:* Reputation in action <http://blog.augure.es/>
>> *Skype:* dragglori
>> *Access map:* Augure Girona
>> <https://maps.google.com/maps?q=Eiximenis+12,+17001+Girona,+Espanya&hl=ca&sll=50.956548,6.799948&sspn=30.199963,86.044922&hnear=Carrer+Eiximenis,+12,+17001+Girona,+Espanya&t=m&z=16>
>>
>>
>> --
>> To unsubscribe:
>> https://lists.nongnu.org/mailman/listinfo/monit-general
>>
>
>
>
> --
> -----BEGIN GEEK CODE BLOCK-----
> Version: 3.1
> GCS/IT d(+) s++:- a C++$ ULC(+)>+++$ !P--- L+>$ !E---? W+++$ !N* !o-- K--?
> w(+) !O---? !M- !V--? PS+? !PE Y+ PGP++>+++ !t-- !5 !X- R(+)>++* tv-? b(-)
> DI !D- G(+)>+ e+++ h--() r->$ y?*
> ------END GEEK CODE BLOCK------
>



-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/IT d(+) s++:- a C++$ ULC(+)>+++$ !P--- L+>$ !E---? W+++$ !N* !o-- K--?
w(+) !O---? !M- !V--? PS+? !PE Y+ PGP++>+++ !t-- !5 !X- R(+)>++* tv-? b(-)
DI !D- G(+)>+ e+++ h--() r->$ y?*
------END GEEK CODE BLOCK------
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to