So I got a number of small cronjobs, that needs to run more frequent then a minute.
So what I usually do is - create shell script with a while loop and sleep statements in it. And then I run it in a screen session.

The problem of course is that it does not start if the server is restarted, also it is not as flexible as init.d scripts.

I checked a number of posts around but there are mainly not so convenient work-around, and I am trying to avoid those.

Is there some platform, or a template I can just pop my while loop into and run it as init.d script ? Or maybe some other convenient solution ?

1 Answer
1

My suggestion would be to add some file lock and checking to your script .
Cronjob checks if there is file lock created by process inside while loop; if there is nothing happens; if there isn't one start a process in while loop.

In addition to that, you may find special cron directive/alias '@reboot' useful to start these processes immediately when system boots/reboots.