Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Aug 2003 22:34:01 -0500
From:      <freebsd@critesclan.com>
To:        <freebsd-ports@freebsd.org>, "Evan Dower" <evantd@hotmail.com>
Subject:   RE: fcrontab and script command nonexecution
Message-ID:  <HCEOIHDIFOIIAGKAGBCHGEDICNAA.freebsd@critesclan.com>
In-Reply-To: <BAY8-F55JLus681680l00024505@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Evan;

I don't use "script" very often because it requires you be running in from a
terminal. I have a lot of cron based scripts which I want to keep the output
from, so I "rolled my own." Here is a VERY SMALL example, with NO ERROR
CHECKING. But it shows you how you can do what you are wanting to do. Save
this someplace, make it executable (of course) and stick it into your
crontab in place of "script."

Lee



#!/bin/sh
SFILE=$1 ; shift
SCMD="$1" ; shift
SREST="$*"
(
echo "Starting $SCMD at `date '+%d-%h-%Y %H:%M:%S'`"
$SCMD $SREST 2>&1
echo "Ending $SCMD at `date '+%d-%h-%Y %H:%M:%S'`"
) 1>$SFILE 2>&1



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?HCEOIHDIFOIIAGKAGBCHGEDICNAA.freebsd>