On Sat, Nov 23, 2019 at 09:40:31PM GMT, m...@chevybeef.com wrote:
> Raf,
> 
> As sure as I can be without looking through source code. 
> 
> I was surprised too but when I ran `env` from within my script and got (via
> the resulting email):
> 
> LOGNAME=root
> HOME=/var/log
> PWD=/var/log
> PATH=/bin:/sbin:/usr/bin:/usr/sbin
> SHELL=/bin/sh
> USER=root
> 
> You are showing what's inside your crontab where $HOME must be evaluating to
> the home directory but the step after that is to call the script, say foo.
> What's the HOME variable set to then?
> 
> Regards,
> Mark

Mark,

You "forgot" to mention that you are running it from root's crontab.
Rather than writing "cron job user", please be more specific next time.

In that case, of course you get /var/log:

        # crontab -l | grep HOME HOME=/var/log

Regards,

Raf

> 
> > -----Original Message-----
> > From: owner-po...@openbsd.org <owner-po...@openbsd.org> On Behalf Of Raf
> > Czlonka
> > Sent: 23 November 2019 21:20
> > To: m...@chevybeef.com
> > Cc: ports@openbsd.org
> > Subject: Re: Keychain man page correction?
> > 
> > On Sat, Nov 23, 2019 at 10:22:23AM GMT, m...@chevybeef.com wrote:
> > > In the man page for keychain it says:
> > >
> > > To load keychain variables from a script (for example from cron) and
> > > abort unless id_dsa is available:
> > >
> > > # Load keychain variables and check for id_dsa [ -z "$HOSTNAME" ] &&
> > > HOSTNAME=`uname -n` . $HOME/.keychain/$HOSTNAME-sh 2>/dev/null ssh-
> > add
> > > -l 2>/dev/null | grep -q id_dsa || exit 1
> > >
> > > However, when run from cron, HOME is set to /var/log and not the home
> > > directory of the cron job user so this doesn't work.
> > >
> > 
> > Mark,
> > 
> > That's very strange, my crontab(5) file is full of:
> > 
> >     @hourly $HOME/bin/foo
> >     @daily  $HOME/bin/bar
> > 
> > Are you sure that's what the issue is?
> > 
> > Regards,
> > 
> > Raf
> 
> 

Reply via email to