Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Apr 2019 10:29:01 -0500
From:      Software Info <softwareinfojam@gmail.com>
To:        Walter Cramer <wfc@mintsol.com>
Cc:        Jonathan Chen <jonc@chen.org.nz>,  "freebsd-stable@freebsd.org" <freebsd-stable@freebsd.org>
Subject:   RE: Crontab Question
Message-ID:  <5caf5d3d.1c69fb81.63ae1.ffd0@mx.google.com>
In-Reply-To: <20190410172638.C14867@mulder.mintsol.com>
References:  <5cae4e6f.1c69fb81.95785.62bf@mx.google.com> <CAJuc1zNRcG5WaZ4weC=TNLuXCfT=oxMtismm%2B6apWXEtJZhH3A@mail.gmail.com> <5cae5cc3.1c69fb81.15e0.dbd1@mx.google.com> <20190410172638.C14867@mulder.mintsol.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Well thanks for all the input. I just have to tp keep working at it. Again,=
 much appreciated.


Regards
SI

Sent from Mail for Windows 10

From: Walter Cramer
Sent: Wednesday, April 10, 2019 4:40 PM
To: Software Info
Cc: Jonathan Chen; freebsd-stable@freebsd.org
Subject: RE: Crontab Question

On Wed, 10 Apr 2019, Software Info wrote:

> OK. So although the script is located in my home directory, it doesn=C3=
=A2=E2=82=AC=E2=84=A2t=20
> start there?  Sorry but I don=C3=A2=E2=82=AC=E2=84=A2t quite understand. =
Could you explain a=20
> little further please?

Both 'cp' and 'ls' are located in /bin.  But if I run the 'ls' command in=20
/root, 'ls' can't find 'cp' (unless I tell it where to look) - even though=
=20
/bin *is* in my PATH -

server7:/root # ls cp
ls: cp: No such file or directory
server7:/root # ls /bin/cp
/bin/cp

Where the system looks for *commands*, to execute, is different from where=
=20
it looks for other files, which those commands use.  The latter is=20
generally only the current directory (unless you tell it otherwise).=20
When cron runs a script as root, "current directory" will be /root.

BUT - for security and other reasons, it would be better to have cron run=20
your script as you (not root), and as '/home/me/myscript' (instead of=20
adding your home directory to PATH in /etc/crontab).

-Walter




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5caf5d3d.1c69fb81.63ae1.ffd0>