On Thu, 2018-06-07, mike wrote:
> Den tisdag 5 juni 2018 kl. 23:05:33 UTC+2 skrev Jorgen Grahn:
>> On Tue, 2018-06-05, mike wrote:
>> > Hi,
>> >
>> > I have the following "bash script" for checking if the webservice for our
>> > sonarQube is up and running.
>> ...
>> > max_repeat=40;
>> > repeat=0;
>>
>> IME, retrying things like this is almost always a mistake. If you try
>> once and fail, then it's not "up and running", right?
...
> Since it takes some time ( differs from time to time) for the
> service to be up I need to have some kind of polling mechanism.
Ok, but why do you have to deal with that situation? Does the service
restart very often, or do you have scenarios/use cases where you
initiate a service start, need to access it immediately, but have no
way of telling when the start finished?
Ideally a service should start synchronously by taking its resources
before going into daemon mode, you can do e.g.
% sudo systemctl start foo && use_foo
I've been in that situation myself, and know it's often outside your
control (someone else's fault) ... but it's worth pointing out.