From owner-freebsd-questions@FreeBSD.ORG Sat Jun 2 08:59:11 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EB7C106564A for ; Sat, 2 Jun 2012 08:59:11 +0000 (UTC) (envelope-from its.code.in.here@gmail.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 9D96B8FC12 for ; Sat, 2 Jun 2012 08:59:10 +0000 (UTC) Received: by wgbds11 with SMTP id ds11so2607369wgb.31 for ; Sat, 02 Jun 2012 01:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=HrSeNpR/l45Iutw4gM0WhHBxVrFPXRnyqVg8u4d5c+U=; b=V74/YzYUskdMaT6nTAZ+NPk62A+rmdw3+7c9EF5NxwXbOnnTYw8Rl0rm5gwwzLSVwN c10c92GoLLl7GQ3tE6Oh2pCkGbetIaLE8MoUw6+rP+PWU1klhyC22AvAImnXx60n5iSC 7IrWFt9HYlUuVfzzIfy5UlcnPhcZEqYEdyS7JFgIofto+PRFMyHtn/glsgHZHgX5SSMA aRzMvrbE9V95uPo+QtF/DmAQFkl3iY5lNhs+xClFGW/rkJF3auTRd2cSUPo2rw20d7cv wosN8nFvSzFmQQsjxWk7MDSUoJ9eIxNuPm7FgcM0UHVqzamWUXtjM0hd0UFuEutkAmn5 34gw== MIME-Version: 1.0 Received: by 10.216.140.160 with SMTP id e32mr4878796wej.46.1338627549274; Sat, 02 Jun 2012 01:59:09 -0700 (PDT) Received: by 10.223.95.201 with HTTP; Sat, 2 Jun 2012 01:59:09 -0700 (PDT) In-Reply-To: <20120601213900.2d0825b6.jan0sch@gmx.net> References: <20120601213900.2d0825b6.jan0sch@gmx.net> Date: Sat, 2 Jun 2012 10:59:09 +0200 Message-ID: From: Dwayne Henderson To: Jens Jahnke Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-questions@freebsd.org Subject: Re: How to crontab screen with script inside and a "don't run it if it's already running" check? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2012 08:59:11 -0000 Hello Jens! Nice. But what to do if the machine reboots or whatever. Would you crontab your new Irssi alias? --Dwayne On Fri, Jun 1, 2012 at 9:39 PM, Jens Jahnke wrote: > Hi, > > On Fri, 1 Jun 2012 20:55:00 +0200 > Dwayne Henderson wrote: > > DH> I run this Ruby script 24/7 (records data from this live stream). > DH> It runs inside a screen though, so it's easy to check in on it > DH> every once in a while. > DH> > DH> But how do I crontab the screen with the script inside it? It has > DH> to be with a "don't run it if it's already running" check. > DH> [...] > > maybe you should create a shell alias. I do the following for my irssi > session: > > # Start irssi within screen or switch to it if it is already running. > alias irssi='if pgrep -u $USER irssi;then screen -U -x irssi;else screen > -S irssi irssi;fi' > > Regards, > > Jens > > -- > 01. Brachet 2012, 21:37 > Homepage : http://www.jan0sch.de > > It is a sobering thought that when Mozart was > my age, he had been dead for 2 years. > -- Tom Lehrer >