From owner-freebsd-questions@FreeBSD.ORG Thu Jan 24 11:27:11 2013 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7489E97 for ; Thu, 24 Jan 2013 11:27:11 +0000 (UTC) (envelope-from its.code.in.here@gmail.com) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by mx1.freebsd.org (Postfix) with ESMTP id 4BDB4FE4 for ; Thu, 24 Jan 2013 11:27:11 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so15628845ieb.11 for ; Thu, 24 Jan 2013 03:27:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type; bh=FHKEbmiwujlASl1aR047x1XUjOdWVfAyK1CaNRLlXnI=; b=fF5NnLCnFUYgee93VMAKp2PBY9jLn6o1RvXbGCw8lxBeExlfueph0lYNqXdI6bkD9z WsIJKvOWUEzlWYHxloox0gz0JvW4ecwKXxU90vKVeQwXxtorBqd+4hmPbkN9w+QZayvz HYpqcLamh3IOrHLneSd4vvwuhlQYQV0xCp8rjGi0BB5cq0MQl02jysH53nkBu5gZm4rf ptMPPGrzDilvI9s3eOLOa7uwPyyX1jvT+h0Gr+s/AHOYVJJ+J9hmandAGgYqfNoPUKDW dpf6slpMRPdvyU9rnAjcDUDHrXHsMxflDV+suCtIt+XUBSRiu5ZAx0FdmsHWaAuX2+Lp NvhA== MIME-Version: 1.0 X-Received: by 10.50.237.103 with SMTP id vb7mr1067615igc.29.1359026830840; Thu, 24 Jan 2013 03:27:10 -0800 (PST) Received: by 10.64.164.164 with HTTP; Thu, 24 Jan 2013 03:27:10 -0800 (PST) Date: Thu, 24 Jan 2013 12:27:10 +0100 Message-ID: Subject: Crontabbing a Ruby script inside a screen From: Dwayne Henderson To: ruby-talk@ruby-lang.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2013 11:27:11 -0000 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 Thank you! --Dwayne