Date: Tue, 16 Jan 2007 20:44:32 -0800 From: Bill Campbell <freebsd@celestial.com> To: freebsd-questions@freebsd.org Subject: Re: CRON Script not working right. Message-ID: <20070117044432.GA23506@ayn.mi.celestial.com> In-Reply-To: <01fe01c739e8$080ca1f0$0300020a@mickey> References: <01fe01c739e8$080ca1f0$0300020a@mickey>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 16, 2007, Don O'Neil wrote: >Anybody have any clues why a shell script run from root's CRON would act >differently then when run directly from the command line? Most often this is because the environment in the cron job is different, either missing variables or having variables that aren't set to a reasonable value (e.g. TERM). The way I usually figure something like this out is to dump the envioronment from the cron job, then do the same thing from the command line, then compare the two. #!/bin/sh # this is the cron job env | sort > /tmp/env.cron exit; Now from the command line ``env | sort > /tmp/cron.cli''. Now run something like ``diff -u /tmp/env.cron /tmp/cron.cli'' to see what is different. Bill -- INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 When a place gets crowded enough to require ID's, social collapse is not far away. It is time to go elsewhere. The best thing about space travel is that it made it possible to go elsewhere. -- Robert Heinlein
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070117044432.GA23506>