From owner-freebsd-questions@freebsd.org Wed Nov 8 21:53:05 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7982BE5CDD3 for ; Wed, 8 Nov 2017 21:53:05 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36D61690AD for ; Wed, 8 Nov 2017 21:53:05 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: by mail-it0-x231.google.com with SMTP id y15so8712928ita.4 for ; Wed, 08 Nov 2017 13:53:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-transfer-encoding; bh=NA24RIYRqXLTeF35lQnXEcODWF3JmUU/XxKwZHk5XRc=; b=fp85U8reuVAzjWPsnezaRGrrpVHYEjK5CfxV+t2rVxnxN5bwLzLrL3Z/xWtyIPQSwo yQuHeVf7DQfveZi/twqBwDQXdMYWoi2hOKOJOlpO7VJI4vLE9pXr+zOVoD1+V8ZlVuCy 00/6B+ZdlHR8uWdoXjeOBcHsUpknQ9qH/HJpq6lzf0NiwBt7+de9lXHZJBC5/1p4gVaG qcqfsabVYu9w2EABjFU4eGah756bGaXG+aCBn/ZZDXgGgimEH0IfnH9hXHBONSYvzNl/ amP0GsydiDCkcmtwoNuXIpLZV972w73hZiilb6oIFi5p7AAegfMRCh0WeOZhlBunX/ar +2Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-transfer-encoding; bh=NA24RIYRqXLTeF35lQnXEcODWF3JmUU/XxKwZHk5XRc=; b=oYznne0am7XFavWmnw1gQ+CXfDygtG5tqIoDupjev930+eB+NdYuqfMshvYJBuqf/c Igmsd3nZ5PfrpS8biNj82/PitI2O7wFrOdbvdfAnjMT2u1iPHjUFfI57xXtohobv3XzU mbSmQkYQOWt92JsOMcGK94Pd/G/bDiVaqpIUPIMEeLhzeod7IdRCkL8Bru2AnjdYe/Ln GiWsm6EMWQUXsTSCbokJD7JS07AHbnCOKhwGFbs1LHySXvxmiDGcbBhoBtAxabINIRZp LSwZuiNNBUvEpda2grlok34A2+NimGPxar3hOAlFlECrzA9pQWXOTS4fsi9cm0Df3VTZ yY4Q== X-Gm-Message-State: AJaThX7HQUVgvdJtZllQV2PVWJbN8Jldg3YZFxnPb7NdNR+AtX1OKLzr rEJxuNI56CTOpztaaXw09/aNhA== X-Google-Smtp-Source: ABhQp+SijcNo/lTiP0JMw5UQjpVRBqQ7WgbtEj2g/JdkUUmJqKLsuMqfl5i4cxPaWl6hpwmVn2nYdA== X-Received: by 10.36.244.5 with SMTP id d5mr2638763iti.3.1510177984559; Wed, 08 Nov 2017 13:53:04 -0800 (PST) Received: from [10.0.10.7] (cpe-65-25-50-122.neo.res.rr.com. [65.25.50.122]) by smtp.googlemail.com with ESMTPSA id r15sm2315914iod.12.2017.11.08.13.53.03 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Nov 2017 13:53:04 -0800 (PST) Message-ID: <5A037CC1.2030200@gmail.com> Date: Wed, 08 Nov 2017 16:53:05 -0500 From: Ernie Luzar User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Polytropon CC: "freebsd-questions@freebsd.org" Subject: Re: sh script echo to syslog References: <5A036890.7090204@gmail.com> <20171108220837.c6cb234d.freebsd@edvax.de> In-Reply-To: <20171108220837.c6cb234d.freebsd@edvax.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 21:53:05 -0000 Polytropon wrote: > On Wed, 08 Nov 2017 15:26:56 -0500, Ernie Luzar wrote: >> Hello list; >> >> I have a sh script that I use echo "message text" and it shows on the >> terminal console that started the script. Thats ok, but I would like to >> also have that same message posted the syslog. > > The easiest way is to use the "logger" command, for example: > > logger -t "" > > If you omit -t , the user account under which the script > runs will be logged; it's probably easier to use the scripts > own identifier for this purpose. If you don't want it to be > hard-coded, use this: > > logger -t `basename $0` "" > > Or with one external program call less: > > logger -t ${0##*/} "" > > That's probably the most convenient approach. :-) > Thanks to all who replied. Logger was just what I needed.