Bug 184409 - [request] crontab(5) environment should include common paths like /sbin or /usr/sbin
Summary: [request] crontab(5) environment should include common paths like /sbin or /u...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-01 14:20 UTC by patdung100
Modified: 2018-05-21 05:04 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description patdung100 2013-12-01 14:20:00 UTC
By default, user's crontab would have below environment variables 

LOGNAME=user1
PATH=/usr/bin:/bin
PWD=/usr/home/user1
HOME=/home/user1
USER=user1
SHELL=/bin/sh

When the script is invoked/test in command line, it worked.
When the script is invoked by cronjob, some part of the script failed
to run because /usr/sbin/chown is not in the search PATH.

It is not convenient.

Fix: 

configure user's crontab to include PATH like /etc/crontab

PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
How-To-Repeat: always
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:51:26 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"
Comment 2 patdung100 2018-05-21 05:04:14 UTC
(In reply to patrick_dkt from comment #0)

comment #0 had typo, it should be:

PATH=/bin:/sbin:/usr/bin:/usr/sbin

(/etc should not be added)