Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Apr 2019 07:58:07 +0200
From:      Willem Offermans <Willem@Offermans.Rompen.nl>
To:        Software Info <softwareinfojam@gmail.com>
Cc:        Richard Mackerras <mack63richard@gmail.com>, Walter Cramer <wfc@mintsol.com>, "freebsd-stable@freebsd.org" <freebsd-stable@freebsd.org>, Jonathan Chen <jonc@chen.org.nz>
Subject:   Re: Crontab Question
Message-ID:  <70AAF9FB-A8E9-4E64-9A58-5F316DD7945B@Offermans.Rompen.nl>
In-Reply-To: <5cafc1dd.1c69fb81.8462d.ffaf@mx.google.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> <5caf5d3d.1c69fb81.63ae1.ffd0@mx.google.com> <36054B2F-3456-46C1-BE1A-FB90551E2AE7@gmail.com> <5cafc1dd.1c69fb81.8462d.ffaf@mx.google.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Dear FreeBSD friends,

Yes, specifying whole directories is a bit counterintuitive, but you get =
used to it.
To me it became part of crontab, with only a vague understanding of why.
Probably all of us went through this process of incorporation once.


Wiel Offermans
Willem@Offermans.Rompen.nl




> On 12 Apr 2019, at 00:38, Software Info <softwareinfojam@gmail.com> =
wrote:
>=20
> Thanks so much for all the replies. It was true that I had to hardcode =
every path but thankfully it is working now. Really appreciate the =
assistance.
>=20
>=20
> Kind Regards
> SI
>=20
>=20
>=20
> From: Richard Mackerras
> Sent: Thursday, April 11, 2019 11:53 AM
> To: Software Info
> Cc: Walter Cramer; freebsd-stable@freebsd.org; Jonathan Chen
> Subject: Re: Crontab Question
>=20
> In your script put a few commands outputting to a check file
>=20
> pwd > /tmp/checkfile
>=20
> Add a few more like=20
>=20
> ENV >> /tmp/checkfile
>=20
> Just to make sure it really is in the directory you expect with the =
environment you expect.=20
>=20
> If you want it to be run as you never use the root crontab unless you =
want really crap security.=20
>=20
> Cheers
>=20
>=20
> Sent from my iPad
>=20
>> On 11 Apr 2019, at 16:29, Software Info <softwareinfojam@gmail.com> =
wrote:
>>=20
>> Well thanks for all the input. I just have to tp keep working at it. =
Again, much appreciated.
>>=20
>>=20
>> Regards
>> SI
>>=20
>> Sent from Mail for Windows 10
>>=20
>> 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
>>=20
>>> On Wed, 10 Apr 2019, Software Info wrote:
>>>=20
>>> 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?
>>=20
>> 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 -
>>=20
>> server7:/root # ls cp
>> ls: cp: No such file or directory
>> server7:/root # ls /bin/cp
>> /bin/cp
>>=20
>> 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.
>>=20
>> 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).
>>=20
>> -Walter
>>=20
>> _______________________________________________
>> freebsd-stable@freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-stable
>> To unsubscribe, send any mail to =
"freebsd-stable-unsubscribe@freebsd.org"
>=20
> _______________________________________________
> freebsd-stable@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to =
"freebsd-stable-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?70AAF9FB-A8E9-4E64-9A58-5F316DD7945B>