Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jun 2012 20:55:00 +0200
From:      Dwayne Henderson <its.code.in.here@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   How to crontab screen with script inside and a "don't run it if it's already running" check?
Message-ID:  <CAOOO88D089cm7Hm00kxPTzGc6p8yHn1bBFFz_4w_JADrMK1z5w@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOOO88D089cm7Hm00kxPTzGc6p8yHn1bBFFz_4w_JADrMK1z5w>