From owner-freebsd-questions@FreeBSD.ORG Tue Jun 24 18:48:48 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 21D9B106564A for ; Tue, 24 Jun 2008 18:48:48 +0000 (UTC) (envelope-from sonic2000gr@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.191]) by mx1.freebsd.org (Postfix) with ESMTP id AC9A88FC12 for ; Tue, 24 Jun 2008 18:48:47 +0000 (UTC) (envelope-from sonic2000gr@gmail.com) Received: by nf-out-0910.google.com with SMTP id h3so59114nfh.33 for ; Tue, 24 Jun 2008 11:48:46 -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 :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=OC6JkPibpTF/7yQSz+7LgWyXcJBjZD1ze1tNZ6vNylI=; b=GrRJAbz/IOb2FQshMRmBy7sZBnXR1ISqVIx8XrlpeLE2jx16avhyLxxwbwaG/mDS3E c6HAIZEDCTD1UjGj7OWmlL62FQxWSb6D3EcbVxmlfVd4xLXLdnt6AiH6HbWJDGe6K7sl XxErc1XlcaV7Gl1Bwf6fcwjsFJBXn7TTH25D8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=hE+uoqedgEFQpkaKkF0jmVWoLuxextSrpZ4w/XGoteNBWC0sUlBPNq2Kfxo4ntBiRC Fd2EaqzrCGN1q5LbmIT8UiTEaKdASJLIDHViCpEQGAJcq0CbWxkqC+MdB46WBtNAsPCy mYc+WN0EQhaF03hhZdCaRYmd7p3vdKHQ+DjHE= Received: by 10.210.71.11 with SMTP id t11mr607844eba.105.1214333326365; Tue, 24 Jun 2008 11:48:46 -0700 (PDT) Received: from atlantis.dyndns.org ( [85.73.189.242]) by mx.google.com with ESMTPS id i4sm47081747nfh.1.2008.06.24.11.48.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 24 Jun 2008 11:48:45 -0700 (PDT) Message-ID: <4861418A.30603@gmail.com> Date: Tue, 24 Jun 2008 21:48:42 +0300 From: Manolis Kiagias User-Agent: Thunderbird 2.0.0.14 (X11/20080607) MIME-Version: 1.0 To: Nicolas Letellier References: <20080624201720.e90b1a07.nicolas@nicoelro.net> In-Reply-To: <20080624201720.e90b1a07.nicolas@nicoelro.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Questions Subject: Re: restart named in a cron 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: Tue, 24 Jun 2008 18:48:48 -0000 Nicolas Letellier wrote: > Hi. > > I want to restart named in a script executed by a cron. My script is: > > #!/bin/sh > # verify named conf and restart it > /usr/sbin/named-checkconf > if [ ! $? -eq 0 ]; then > echo "Errors when verifying named configuration" > exit 1 > else > /etc/rc.d/named restart > /dev/null > fi > > # Ok, it's done > exit 0 > > > However, the cron returns some errors: > umount: not found > mtree: not found > umount: not found > mount: not found > /etc/rc.d/named: WARNING: devfs_domount(): Unable to mount devfs on /var/named/dev > devfs: not found > devfs: not found > > I can restart named manually, but not with a cron. > > Do you have an idea to solve this problem? Why could I restart it manually and not with a cron? > > Thanks! > > Well, probably cron does not share your environment, thus it does not have your PATH. It simply cannot find the commands you see as "not found". Try inserting something like: PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin at the top of your script. Alternatively, you could use full paths to the commands in the script, but it seems the errors come from the system scriprt, /etc/rc.d/named and you wouldn't want to touch that.