Crontab Question
Willem Offermans
Willem at Offermans.Rompen.nl
Fri Apr 12 05:58:30 UTC 2019
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 at Offermans.Rompen.nl
> On 12 Apr 2019, at 00:38, Software Info <softwareinfojam at gmail.com> wrote:
>
> 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.
>
>
> Kind Regards
> SI
>
>
>
> From: Richard Mackerras
> Sent: Thursday, April 11, 2019 11:53 AM
> To: Software Info
> Cc: Walter Cramer; freebsd-stable at freebsd.org; Jonathan Chen
> Subject: Re: Crontab Question
>
> In your script put a few commands outputting to a check file
>
> pwd > /tmp/checkfile
>
> Add a few more like
>
> ENV >> /tmp/checkfile
>
> Just to make sure it really is in the directory you expect with the environment you expect.
>
> If you want it to be run as you never use the root crontab unless you want really crap security.
>
> Cheers
>
>
> Sent from my iPad
>
>> On 11 Apr 2019, at 16:29, Software Info <softwareinfojam at gmail.com> wrote:
>>
>> 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 at 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’t
>>> start there? Sorry but I don’t quite understand. Could you explain a
>>> little further please?
>>
>> Both 'cp' and 'ls' are located in /bin. But if I run the 'ls' command in
>> /root, 'ls' can't find 'cp' (unless I tell it where to look) - even though
>> /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
>> it looks for other files, which those commands use. The latter is
>> generally only the current directory (unless you tell it otherwise).
>> 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
>> your script as you (not root), and as '/home/me/myscript' (instead of
>> adding your home directory to PATH in /etc/crontab).
>>
>> -Walter
>>
>> _______________________________________________
>> freebsd-stable at freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-stable
>> To unsubscribe, send any mail to "freebsd-stable-unsubscribe at freebsd.org"
>
> _______________________________________________
> freebsd-stable at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to "freebsd-stable-unsubscribe at freebsd.org"
More information about the freebsd-stable
mailing list