From owner-freebsd-questions@FreeBSD.ORG Mon Sep 16 11:47:11 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id ED46D4DA for ; Mon, 16 Sep 2013 11:47:11 +0000 (UTC) (envelope-from paul@ifdnrg.com) Received: from outbound.ifdnrg.com (outbound.ifdnrg.com [193.200.98.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 916742615 for ; Mon, 16 Sep 2013 11:47:11 +0000 (UTC) Received: from [192.168.100.68] (cpc2-sgyl30-2-0-cust423.sgyl.cable.virginmedia.com [80.192.35.168]) (authenticated bits=0) by outbound.ifdnrg.com (8.14.7/8.14.5) with ESMTP id r8GBR3p4080807 for ; Mon, 16 Sep 2013 12:27:03 +0100 (BST) (envelope-from paul@ifdnrg.com) X-Authentication-Warning: outbound.ifdnrg.com: Host cpc2-sgyl30-2-0-cust423.sgyl.cable.virginmedia.com [80.192.35.168] claimed to be [192.168.100.68] Message-ID: <5236EB03.7040001@ifdnrg.com> Date: Mon, 16 Sep 2013 12:26:59 +0100 From: Paul Macdonald User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: test if script called by cron Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit 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: Mon, 16 Sep 2013 11:47:12 -0000 Hi, Is there a simple way of testing whether a given script was called via cron, I'd rather find a solution that would work from within the script rather than setting an environment variable in the crontab. thanks Paul. (anyone here going to EuroBSD con?) -- ------------------------- Paul Macdonald IFDNRG Ltd Web and video hosting ------------------------- t: 0131 5548070 m: 07970339546 e: paul@ifdnrg.com w: http://www.ifdnrg.com ------------------------- IFDNRG 40 Maritime Street Edinburgh EH6 6SA ---------------------------------------------------- High Specification Dedicated Servers from £100.00pm ----------------------------------------------------