
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tlug] cron and lftp problems
On Wed, 26 Jan 2005 01:30:25 -0800 (PST), Jake Morrison
<jake_morrison@example.com> wrote:
> The PATH for cron scripts is different from that of your interactive shell.
>
> Generally speaking, from a security standpoint, it is not a good idea to
> rely on the PATH for administrative scripts.
>
> You should just hard code the path to the lftp command in the script,
> e.g. /usr/bin/lftp -e ......
I put a bunch of "constants" at the top of my scripts:
AWK=/bin/awk
CAT=/bin/cat
GREP=/bin/grep
SCP=/usr/bin/scp
SED=/bin/sed
SSH=/usr/bin/ssh
And then, my commands look like this:
servers=`${CAT} ${file} | ${SED} -e 's/\t/ /g' | ${AWK} '{ print $1 }'`
for i in ${servers}; do
${SSH} $i ${GREP} foo ${foofile}
if [ $? -ne 0 ]; then
${SCP} ${foofile} $i:${foofile}
fi
done
-Josh
Home |
Main Index |
Thread Index