Re: Path And 'cron'
On Mon, 20 Feb 2006, Tim Daneliuk wrote: In case you're interested (or anyone else listening), it seems that 'chown' likes to live in /usr/sbin - i.e., A place not in the default path. As it happens, a root cron task is trying to run a script that uses 'chown' and is thus failing. I can change the PATH just for root's crontab and solve the problem. I was just curious if there was a way to more broadly modify the defaults used by cron. The standard solution would be to use a full path to the command in the script (/usr/sbin/chown). If it's used in multiple locations, defining it as a shell variable makes it maintainable: CHOWN=/usr/sbin/chown ${CHOWN} somefile ... ${CHOWN} anotherfile -Warren Block * Rapid City, South Dakota USA ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Path And 'cron'
Warren Block wrote: On Mon, 20 Feb 2006, Tim Daneliuk wrote: In case you're interested (or anyone else listening), it seems that 'chown' likes to live in /usr/sbin - i.e., A place not in the default path. As it happens, a root cron task is trying to run a script that uses 'chown' and is thus failing. I can change the PATH just for root's crontab and solve the problem. I was just curious if there was a way to more broadly modify the defaults used by cron. The standard solution would be to use a full path to the command in the script (/usr/sbin/chown). If it's used in multiple locations, defining it as a shell variable makes it maintainable: CHOWN=/usr/sbin/chown ${CHOWN} somefile ... ${CHOWN} anotherfile -Warren Block * Rapid City, South Dakota USA The problem in this case is that it is not a shell script I own or maintain - it is the shell script provided with 'nessus' to update its plugins. I could certainly modify the script, but then I'd have to remember to do this every time I upgraded the program. I prefer fire and forget solutions that take care of themselves automatically. Hence my desire to be able to change the default path cron uses in some config file -- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Path And 'cron'
Date: Tue, 21 Feb 2006 09:25:11 -0600 From: Tim Daneliuk [EMAIL PROTECTED] Subject: Re: Path And 'cron' To: Warren Block [EMAIL PROTECTED] Cc: freebsd-questions@freebsd.org Message-ID: [EMAIL PROTECTED] The problem in this case is that it is not a shell script I own or maintain - it is the shell script provided with 'nessus' to update its plugins. I could certainly modify the script, but then I'd have to remember to do this every time I upgraded the program. I prefer fire and forget solutions that take care of themselves automatically. Hence my desire to be able to change the default path cron uses in some config file Forgive me for missing the early parts of this thread, but why not just put a PATH directive in your crontab? ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Path And 'cron'
Randy Pratt wrote: On Sun, 19 Feb 2006 15:25:49 -0600 Tim Daneliuk [EMAIL PROTECTED] wrote: Where is the default path for cron jobs established? (And can it be changed...) Take a look at: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-cron.html and see if that answers your question. Best regards, Randy -- Well ... it answered my question partially. But as I looked back over it, I realized my central questions are still unanswered: If I do not have a PATH= statement in a particular user's crontab, what is used for a default PATH? Is the path in /etc/crontab inherited somehow? Given that the default shell is /bin/sh, are the settings in /etc/profile observed? If no PATH is established there either, what will cron use? I am trying to determine the best place to establish correct global PATH settings for all cron users so I don't have to edit each users' crontab file when file locations are updated or changed. TIA, -- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Path And 'cron'
On Mon, 20 Feb 2006 10:21:22 -0600 Tim Daneliuk [EMAIL PROTECTED] wrote: Randy Pratt wrote: On Sun, 19 Feb 2006 15:25:49 -0600 Tim Daneliuk [EMAIL PROTECTED] wrote: Where is the default path for cron jobs established? (And can it be changed...) Take a look at: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-cron.html and see if that answers your question. Best regards, Randy -- Well ... it answered my question partially. But as I looked back over it, I realized my central questions are still unanswered: If I do not have a PATH= statement in a particular user's crontab, what is used for a default PATH? From man 5 crontab : Several environment variables are set up automatically by the cron (8) daemon. SHELL is set to /bin/sh, PATH is set to /usr/bin:/bin, and LOGNAME and HOME are set from the /etc/passwd line of the crontab's owner. HOME, PATH and SHELL may be overridden by settings in the crontab; LOGNAME may not. Is the path in /etc/crontab inherited somehow? Given that the default shell is /bin/sh, are the settings in /etc/profile observed? If no PATH is established there either, what will cron use? I am trying to determine the best place to establish correct global PATH settings for all cron users so I don't have to edit each users' crontab file when file locations are updated or changed. It seems that the PATH is being set in the source code, in particular /usr/src/usr.sbin/cron/cron/pathnames.h : #ifndef _PATH_DEFPATH # define _PATH_DEFPATH /usr/bin:/bin #endif I suppose its possible to change the source and rebuild but there may be subtle interactions that aren't readily apparent that would need to be considered. There may even be a knob to tweak somewhere for this. Sorry I can't give you a definitive answer on this. Perhaps someone with more direct experience can give you proper guidance here. Best regards, Randy -- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Path And 'cron'
Randy Pratt wrote: SNIP If I do not have a PATH= statement in a particular user's crontab, what is used for a default PATH? From man 5 crontab : Several environment variables are set up automatically by the cron (8) daemon. SHELL is set to /bin/sh, PATH is set to /usr/bin:/bin, and LOGNAME and HOME are set from the /etc/passwd line of the crontab's owner. HOME, PATH and SHELL may be overridden by settings in the crontab; LOGNAME may not. I wonder if I can use the PATH=$PATH:/my/new/stuff formulation in a crontab file to preserve this default. I'll have to look into that. Is the path in /etc/crontab inherited somehow? Given that the default shell is /bin/sh, are the settings in /etc/profile observed? If no PATH is established there either, what will cron use? I am trying to determine the best place to establish correct global PATH settings for all cron users so I don't have to edit each users' crontab file when file locations are updated or changed. It seems that the PATH is being set in the source code, in particular /usr/src/usr.sbin/cron/cron/pathnames.h : #ifndef _PATH_DEFPATH # define _PATH_DEFPATH /usr/bin:/bin #endif I suppose its possible to change the source and rebuild but there may be subtle interactions that aren't readily apparent that would need to be considered. There may even be a knob to tweak somewhere for this. That's what I was hoping for - tweaking the source is not a very clean way to solve my problem. In case you're interested (or anyone else listening), it seems that 'chown' likes to live in /usr/sbin - i.e., A place not in the default path. As it happens, a root cron task is trying to run a script that uses 'chown' and is thus failing. I can change the PATH just for root's crontab and solve the problem. I was just curious if there was a way to more broadly modify the defaults used by cron. Thanks again, for your time in this matter ... -- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Path And 'cron'
Where is the default path for cron jobs established? (And can it be changed...) TIA, -- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Path And 'cron'
Tim, The default location crontabs are stored in is /var/cron/tabs/username/, and yes they can be edited manually. -David On 2/19/06, Tim Daneliuk [EMAIL PROTECTED] wrote: Where is the default path for cron jobs established? (And can it be changed...) TIA, -- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Path And 'cron'
On Sun, 19 Feb 2006 15:25:49 -0600 Tim Daneliuk [EMAIL PROTECTED] wrote: Where is the default path for cron jobs established? (And can it be changed...) Take a look at: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-cron.html and see if that answers your question. Best regards, Randy -- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]