Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

screen -dmS 17secondjob perl -e 'while(1){`run the command`;sleep 17}'



Or, simpler, use watch:

watch -n 17 -p command

Make a wrapper to run command in the background (&) if the process runtime is greater than your interval.


This will not run the `command` in 17 seconds intervals. You need to take into account the amount of time that it takes to run it.


Ok. Whilst we're being anal:

screen -dmS 17secondjob perl -Mthreads -e 'while(1){threads->create(sub{`run the command`})->detach();sleep 17}'


Or just use watch.


Cool. I was unfamiliar with this command. Looks useful.


Look for `watch -p'.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: