Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jan 2013 19:04:30 +0200
From:      Volodymyr Kostyrko <c.kworr@gmail.com>
To:        Dwayne Henderson <its.code.in.here@gmail.com>
Cc:        ruby-talk@ruby-lang.org, questions@freebsd.org
Subject:   Re: Crontabbing a Ruby script inside a screen
Message-ID:  <5101699E.1050001@gmail.com>
In-Reply-To: <CAOOO88C9p7GRFsC12SRHq_62sM%2BQJjwKgAH%2BDbtxANZOO0%2Bpng@mail.gmail.com>
References:  <CAOOO88C9p7GRFsC12SRHq_62sM%2BQJjwKgAH%2BDbtxANZOO0%2Bpng@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
24.01.2013 13:27, Dwayne Henderson:
> Hi, I run this Ruby + Sequel script inside a screen that records data from
> this live stream 24/7. But it tends to core dump every once in a while, and
> since I run it in a screen (so it's easy to check in on), I can't really
> scroll up to catch the error whenever it happens.
>
> So how do I crontab the screen with the Ruby script inside it? Has to be
> with a "don't run it if it's already running" check to avoid fatal
> consequences. So far I have:
>
> $ crontab -e
>
> */10 * * * * lockf -t 0 /home/anonymous/.myscript.rb.lock
> /usr/local/bin/screen -d -m -S myscript
> /home/anonymous/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
> /home/anonymous/myscript.rb

Another suggestion would be using daemon(8) with -r option.

-- 
Sphinx of black quartz, judge my vow.



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