[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: crontab hour range 6-midnight



Bob Proulx wrote:
> Jochen Spieker wrote:
> > Bob Proulx:
> > >   # The default vixie-cron PATH is "/usr/bin:/bin", overriding the environment.
> > >   PATH = "/home/rwp/bin:/usr/local/bin:/usr/bin:/bin:/usr/games"
> > 
> > You still can use
> > 
> > PATH = "~/bin:/usr/local/bin:/usr/bin:/bin:/usr/games"
> > 
> > if the crontab belongs to the user 'rwp'.
> 
> Having a literal '~/' in there works for bash.  But it doesn't work
> for /bin/sh linked to dash for example.  On Debian /bin/sh defaults to
> being linked to /bin/dash, not bash, these days and in that case using
> ~/ wouldn't work.
> 
> So I guess that if ~ is used in PATH then SHELL should also be set to
> bash too.  That combination is fine.  And then of course all of the
> other fun bash'isms on the command line would also work.

Ah...  But bash doesn't clean up the path for it's own children.  So
actually that does not work.  Or works only in a restricted subset.
Because if the command executed invokes other commands those other
commands will get PATH with a ~/ in it and unless they also decode
that syntax they might fail.

So beware.  Switched it back to the full path in PATH without the ~/
in it.  And should file a bug against the crontab(5) man page about
the problem too.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: