how to simulate a user's crontab?

John Almberg jalmberg at identry.com
Thu Jul 17 02:03:13 UTC 2008


>
> I'm guessing you're having problems with environment settings,  
> although
> the vagaries of the question don't give me much to go on (something
> along the lines of, "when I try to do x in cron, I get the error y;
> but it works fine when the user runs it outside of cron" would be more
> informative.)
>

Well, this got me thinking and I had to do some playing around to  
figure out what was wrong...

The difference was that I was testing the command by su-ing into the  
user, rather than logging in as that user. What I didn't know was su  
does not change your environment, only permissions (as far as I can  
tell)

So I was testing with my environment, but crontab was running under  
the other user's environment.

I always thought that su user and login user were equivalent. Now I  
know better :-)

Anyway, thanks for putting me on the right path.

-- John



More information about the freebsd-questions mailing list