From owner-freebsd-questions@FreeBSD.ORG Fri Apr 4 20:46:23 2008 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 D0B9E1065671 for ; Fri, 4 Apr 2008 20:46:23 +0000 (UTC) (envelope-from ranceh@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.170]) by mx1.freebsd.org (Postfix) with ESMTP id 93FF28FC14 for ; Fri, 4 Apr 2008 20:46:23 +0000 (UTC) (envelope-from ranceh@gmail.com) Received: by wf-out-1314.google.com with SMTP id 25so228681wfa.7 for ; Fri, 04 Apr 2008 13:46:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=tJOezPO0O84OyUx2ki6yS3XzzP4uoXs/KV10+K3GYfU=; b=pJG8/JGQn1Ilv3n8G8Czur4v7CoT6cCBA9x4u7AMDpv5yqqFr5PoCbpYWH7Ev/9iYxNsbzzwvoU+OlzSScwLiQOBXtpEdwep9O90Dp9QDrKQdPdUJ0Sg5bqe51XXjMwuY1LonC7D3prYPlw1TsI3/qHbtVDMeGEVMycAyOg7fSI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=roUjOzpjcubV4xmVD44pfkSBzdShyklaGsa2CqE81MyTadI8ZNJ/T4SD0r4Fqz0EGG+yhLlA/ZMWmgL1R6auqGoOGcYPadeAJfhZSKjmm8qorri/z3I2bZ/+r7PFevAIladLXtO3e6sgvQdXldZFzmpD8CfC795K6hA7YQ+vFGc= Received: by 10.142.255.12 with SMTP id c12mr1366158wfi.26.1207340477756; Fri, 04 Apr 2008 13:21:17 -0700 (PDT) Received: by 10.142.194.10 with HTTP; Fri, 4 Apr 2008 13:21:17 -0700 (PDT) Message-ID: <845c0f80804041321j44439881yb67458980edab102@mail.gmail.com> Date: Fri, 4 Apr 2008 15:21:17 -0500 From: "Rance Hall" To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: need a shell script that can be executed manually or as part of the rc process. How can the script detect WHERE it is being called from to know how to handle various options. 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: Fri, 04 Apr 2008 20:46:23 -0000 I have a sh script im working on that is going to be able to run by the init/rc process. That same script can also be run after the system is started. I need a way to have the sh script detect WHERE in the boot process the server is when it is being executed. for example, once a login prompt appears there should be a getty running. prior to that time there shouldnt be a getty running, and if there isnt a gettty running, then the script must be called from the rc process and therefore I can do X instead of Y which I do when the system is fully operational. This is my thought process but I dont understand how to carry it out, or if the thought process actually makes sense. is there a better way for me to do what Im trying to do, and if there isnt and Im on the right track, how do I do what Im asking?