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

Reply via email to