title: How to stop infinite loop in bash script gracefully?
body: <p>I need to run application in every X seconds, so, as far as cron does not work with seconds this way, I wrote a bash script with infinite loop having X seconds sleep in it.</p>
  
  <p>When I have to stop the running script manually, I would like to do it in a correct way - let the application complete functioning and just do not enter the loop for the next time.</p>
  
  <p>Do you have any idea, how this can be achieved?
  I thought about passing arguments, but I could not find how to pass argument to running script.</p>