If two different users want to use two different cp commands the default path 
won't help. Set variables for your commands (with absolute path) in your 
script, and you can avoid this issue.

Neil

> -----Original Message-----
> From: sysadmin-discuss-boun...@opensolaris.org [mailto:sysadmin-
> discuss-boun...@opensolaris.org] On Behalf Of William Yang
> Sent: Tuesday, May 04, 2010 8:17 PM
> To: 'Rainer Heilke'; 'Tonmaus'
> Cc: sysadmin-discuss@opensolaris.org
> Subject: Re: [sysadmin-discuss] cron command set problems
> 
> Can't cron's default path by set by /etc/default/cron?  (See manpage
> for
> cron(1M))
> 
> > -----Original Message-----
> > From: sysadmin-discuss-boun...@opensolaris.org [mailto:sysadmin-
> discuss-
> > boun...@opensolaris.org] On Behalf Of Rainer Heilke
> > Sent: Tuesday, May 04, 2010 7:44 PM
> > To: Tonmaus
> > Cc: sysadmin-discuss@opensolaris.org
> > Subject: Re: [sysadmin-discuss] cron command set problems
> >
> > On 5/4/2010 3:04 AM, Tonmaus wrote:
> > > Hi,
> > >
> > > How do I make sure that a script is running the same commands that
> the
> > user owning the crontab from where I am running it?
> > > Example: As it seems, when I run the same script from bash,
> manually
> i.e.
> > /usr/gnu/bin/cp is used, and when the script is executed from cron,
> it
> > will use /usr/bin/cp. That duality is annoying for me, as cp has
> different
> > fucntions in both cases. What will be the best way to fix this, for
> the
> > home-grown stuff specifically, other than finding out for each
> command by
> > try-and-error.
> > >
> > > Thanks for help.
> > >
> > > Tonmaus
> >
> > This is an excellent example of why we should get into the habit of
> > writing scripts calling commands explicitly. That is, change your
> > references of "cp" to explicitly call "/usr/gnu/bin/cp". This also
> > ensures other people calling the script get the same behaviour. It
> also
> > protects against $PATH changes. I still forget this at times.
> >
> > There was also a post on blogs.sun.com about how this can possibly
> speed
> > up the script.
> >
> > Rainer
> > --
> > Mind the Gap
> > Web: http://www.dragonhearth.com
> > Blog: http://chaos.dragonhearth.com
> > _______________________________________________
> > sysadmin-discuss mailing list
> > sysadmin-discuss@opensolaris.org
> > http://mail.opensolaris.org/mailman/listinfo/sysadmin-discuss
> 
> _______________________________________________
> sysadmin-discuss mailing list
> sysadmin-discuss@opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/sysadmin-discuss
_______________________________________________
sysadmin-discuss mailing list
sysadmin-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/sysadmin-discuss

Reply via email to