Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: cron not defining PATH
More info:
root's cron job does work. I have it run a script that simply is just
one line:
echo $PATH
The cron email has:
X-Cron-Env: <PATH=/bin:/sbin:/usr/bin:/usr/sbin>
And the body is:
/bin:/sbin:/usr/bin:/usr/sbin
root's crontab specifically defines the PATH.
# crontab -l -u root | grep PATH
PATH=/bin:/sbin:/usr/bin:/usr/sbin
But running the shell script as a normal user does:
X-Cron-Env: </usr/bin:/bin:/usr/pkg/bin:/usr/local/bin>
(notice no PATH=)
The output is:
/usr/bin:/bin:/usr/pkg/bin:/usr/local/bin
(see it has different PATH)
So then I had it also run "env" and "export" in the shell script. For
the root it is:
CRON_WITHIN=7200
PWD=/var/log
HOME=/var/log
PATH=/bin:/sbin:/usr/bin:/usr/sbin
USER=root
LOGNAME=root
SHELL=/bin/sh
CRON_WITHIN
HOME
LOGNAME
PATH
PWD
SHELL
USER
(notice root's does have PATH)
For the regular user it is:
PWD=/home/jreed
HOME=/home/jreed
USER=jreed
LOGNAME=jreed
SHELL=/bin/sh
HOME
LOGNAME
PWD
SHELL
USER
(notice no PATH)
Now when I do set PATH in the user's crontab, it is fixed:
X-Cron-Env: <PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin:/foo/bar>
and my output:
/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin:/foo/bar
PWD=/home/jreed
HOME=/home/jreed
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin:/foo/bar
USER=jreed
LOGNAME=jreed
SHELL=/bin/sh
HOME
LOGNAME
PATH
PWD
SHELL
USER
I will open a ticket if needed.
Home |
Main Index |
Thread Index |
Old Index