From owner-freebsd-questions@FreeBSD.ORG Tue Jul 26 11:00:52 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5806A16A41F for ; Tue, 26 Jul 2005 11:00:52 +0000 (GMT) (envelope-from xfb52@dial.pipex.com) Received: from smtp-out5.blueyonder.co.uk (smtp-out5.blueyonder.co.uk [195.188.213.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id A18DB43D49 for ; Tue, 26 Jul 2005 11:00:50 +0000 (GMT) (envelope-from xfb52@dial.pipex.com) Received: from [82.41.37.55] ([82.41.37.55]) by smtp-out5.blueyonder.co.uk with Microsoft SMTPSVC(5.0.2195.6713); Tue, 26 Jul 2005 12:01:35 +0100 Message-ID: <42E617E1.6000407@dial.pipex.com> Date: Tue, 26 Jul 2005 12:00:49 +0100 From: Alex Zbyslaw User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-GB; rv:1.7.8) Gecko/20050530 X-Accept-Language: en, en-us, pl MIME-Version: 1.0 To: Graham Bentley References: <000101c591c6$14846420$4801a8c0@ws-ew-3.W2KDEMIG> In-Reply-To: <000101c591c6$14846420$4801a8c0@ws-ew-3.W2KDEMIG> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 26 Jul 2005 11:01:35.0499 (UTC) FILETIME=[639775B0:01C591D1] Cc: freebsd-questions@freebsd.org Subject: Re: Where to put scripts ? 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, 26 Jul 2005 11:00:52 -0000 Norbert Koch wrote: >>I have a short script for Flexbackup ; >> >>#!/bin/sh >># Backup using Flexbackup >>/bin/rm -f /data/IT/Backup_Log/data* >>/usr/local/bin/flexbackup -newtape >>/usr/local/bin/flexbackup -dir /data >>/usr/bin/mt -f /dev/sa0 rewind >>/usr/bin/mt -f /dev/sa0 offline >> >>I put this in /usr/bin/ and made exec >> >>In crontab I put ; >> >># Flexbackup Nightly Backup Job >>0 2 * * 1-5 root /usr/bin/backup >> >>If I run the script manually at the prompt >>it works perfectly and a new log is written >>to /data/IT/Backup_Log/ - Great ! >> >>(From flexbackup.conf >> >>$logdir = '/data/IT/Backup_Log'; # directory for log files) >> >>If cron runs it, the old log is rm'ed but no new one is written ??? >> >>Is it something to do with paths / perms ? >> >> > >Look into crontab(5). There is a section about the environment settings. >My idea is that flexbackup calls some program w/o full path. >Is flexbackup a shell/perl/* script? > > I would also ask, why are you putting it in /usr/bin? Given that your script calls things in /usr/local/bin already, there is no advantage I can see to polluting /usr/bin. To test Norbert's hypothesis, take everything except standard directories out of your path and then try running your script. Does the user owning the cronjob receive any mail with suggestive errors? --Alex