How to crontab screen with script inside and a "don't run it if it's already running" check?

Dwayne Henderson its.code.in.here at gmail.com
Fri Jun 1 18:55:02 UTC 2012


I run this Ruby script 24/7 (records data from this live stream). It runs
inside a screen though, so it's easy to check in on it every once in a
while.

But how do I crontab the screen with the script inside it? It has to be
with a "don't run it if it's already running" check.

So far I have this (untested) - what y'all think?

*/10 * * * * lockf -t 0 /home/anonymous/.myscript.lock
/usr/local/bin/screen -dm
/home/anonymous/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
/home/anonymous/myscript.rb

--Dwayne


More information about the freebsd-questions mailing list