Operating System - HP-UX
1825077 Members
4878 Online
109679 Solutions
New Discussion юеВ

the profile of crontab user

 
peterchu
Super Advisor

the profile of crontab user

one of the user ( eg. userA ) can run the schedule job (crontab) , does this user load the /etc/profile setting when run the schedule job ? for example , I hv set the PATH setting to the /etc/profile , if the userA run the batch job , will it load this PATH setting before run the batch job ? thx
3 REPLIES 3
Fred Ruffet
Honored Contributor

Re: the profile of crontab user

default for cronjobs is not to source profile. You should include it in your crontab shells or run commands in a way they source profile (ie : "su - user -c command" in root crontab or "/userhome/.profile && command" in user crontab)

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Jan Sladky
Trusted Contributor

Re: the profile of crontab user

Hi Peter,

acording to my experiences, crontab doesn't read neither /etc/profile nor $HOME/.profile

Therefore you should set all variables inside the scripts

br Jan
GSM, Intelligent Networks, UNIX
john korterman
Honored Contributor

Re: the profile of crontab user

Hi,
you should think of a user performing a cron job as a user who does not perform any kind of login; hence he does not read the "normal" files setting his environment.
As a starting point, he has only four variables, which are supplied by cron - from the man page of crontab:

HOME=user's-home-directory
LOGNAME=user's-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh


That is why things never work!

regards,
John K.
it would be nice if you always got a second chance