From owner-freebsd-questions@FreeBSD.ORG Wed Oct 31 14:23:14 2007 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 F26E316A47B for ; Wed, 31 Oct 2007 14:23:13 +0000 (UTC) (envelope-from john@jnielsen.net) Received: from ns1.jnielsen.net (ns1.jnielsen.net [69.55.238.237]) by mx1.freebsd.org (Postfix) with ESMTP id CC53313C48E for ; Wed, 31 Oct 2007 14:23:13 +0000 (UTC) (envelope-from john@jnielsen.net) Received: from ns1.jnielsen.net (jn@ns1 [69.55.238.237]) by ns1.jnielsen.net (8.12.9p2/8.12.9) with ESMTP id l9VE2s69060895; Wed, 31 Oct 2007 10:02:54 -0400 (EDT) (envelope-from john@jnielsen.net) Received: (from www@localhost) by ns1.jnielsen.net (8.12.9p2/8.12.9/Submit) id l9VE2s3d060894; Wed, 31 Oct 2007 10:02:54 -0400 (EDT) (envelope-from john@jnielsen.net) X-Authentication-Warning: ns1.jnielsen.net: www set sender to john@jnielsen.net using -f Received: from nc-2wac-zop09.wachovia.com (nc-2wac-zop09.wachovia.com [162.111.235.21]) by newwebmail.jnielsen.net (Horde MIME library) with HTTP; Wed, 31 Oct 2007 10:02:53 -0400 Message-ID: <20071031100253.n1px37ytk4gc0440@newwebmail.jnielsen.net> Date: Wed, 31 Oct 2007 10:02:53 -0400 From: John Nielsen To: Mike Jeays References: <2cd0a0da0710310458t49610b34h9b19366c3765fe0@mail.gmail.com> <200710310852.20319.mike.jeays@rogers.com> In-Reply-To: <200710310852.20319.mike.jeays@rogers.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.0.4) / FreeBSD-4.9 X-Virus-Scanned: ClamAV version 0.88.4, clamav-milter version 0.88.4 on ns1.jnielsen.net X-Virus-Status: Clean Cc: freebsd-questions@freebsd.org Subject: Re: Help with Cron pleazzzzzzzzzzzz 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: Wed, 31 Oct 2007 14:23:14 -0000 Quoting Mike Jeays : > On October 31, 2007 07:58:21 am VeeJay wrote: >> I am running a status script written in Perl (*status.pl*) and want to have >> it *Always Running*. >> >> How can I check through CRON that "status.pl" is running and if NO, then >> start the script execution again? >> >> Please help and advise... > > You could write a shell script something like: A couple nits: > #!/bin/bash #!/bin/sh > ps -ax | grep 'status.pl' This should probably be something like "ps -ax | grep 'status.pl' | grep -v grep" so you don't get false positives from the grep process itself. JN > if [ $q -eq 0 ] > then > status.pl > fi > > grep will return zero if it finds a line containing 'status.pl', and 1 > otherwise. > > in crontab, use > > * * * * * /full/path/to/script-above > > and it will check every minute. > > But a better fix would be to find the bug in status.pl that makes it crash! > > > > > -- > Mike Jeays > http://www.jeays.ca > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > >