From owner-freebsd-questions@FreeBSD.ORG Fri Apr 25 14:31:29 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 493A11065670 for ; Fri, 25 Apr 2008 14:31:29 +0000 (UTC) (envelope-from jalmberg@identry.com) Received: from mx1.identry.com (on.identry.com [66.111.0.194]) by mx1.freebsd.org (Postfix) with ESMTP id C85D48FC1F for ; Fri, 25 Apr 2008 14:31:28 +0000 (UTC) (envelope-from jalmberg@identry.com) Received: (qmail 97632 invoked by uid 89); 25 Apr 2008 14:31:27 -0000 Received: from unknown (HELO ?192.168.1.110?) (jalmberg@75.127.142.66) by mx1.identry.com with ESMTPA; 25 Apr 2008 14:31:27 -0000 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: John Almberg Date: Fri, 25 Apr 2008 10:31:13 -0400 To: freebsd-questions@freebsd.org X-Mailer: Apple Mail (2.752.3) Subject: Re: Cron question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Apr 2008 14:31:29 -0000 > > ...and invoking this wrapper from cron instead of trying to reset > the shell and everything from within cron. You can test things by > doing an "su gs -c /bin/sh" from a root login and then trying to > run your wrapper, which will give you a minimum environment closer > to what cron executes under. > This was an interesting idea. I wrote a little ruby script to print out all set environment variable, then ran it under the simulated cron environment: bin 520 $ su gs -c /bin/sh $ ./env.rb USER => gs MAIL => /var/mail/gs SHLVL => 2 HOME => /home/gs _ => /bin/sh BLOCKSIZE => K TERM => xterm-color SVN_EDITOR => vim PATH => /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/ local/bin:/usr/X11R6/bin:/home/gs/bin SHELL => /usr/local/bin/bash PWD => /home/gs/bin FTP_PASSIVE_MODE => YES EDITOR => vim $ Then under the environment I used to run the script by hand: [gs@on ~/bin]$ ./env.rb TERM => xterm-color SHELL => /usr/local/bin/bash OLDPWD => /home/gs SSH_TTY => /dev/ttyp0 USER => gs SVN_EDITOR => vim FTP_PASSIVE_MODE => YES MAIL => /var/mail/identry PATH => /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/ local/bin:/usr/X11R6/bin:/home/identry/bin BLOCKSIZE => K PWD => /home/gs/bin EDITOR => vim HOME => /home/gs SHLVL => 2 LOGNAME => identry _ => ./env.rb I don't see any difference that would explain this problem... No mail is sent to either root or gs when the crontab runs. Someone asked what version of PHP... ~ 504 $ php --version PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Jan 6 2008 18:26:54) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies ~ 505 $ And if bash is really installed: ~ 505 $ bash --version GNU bash, version 3.2.33(0)-release (amd64-portbld-freebsd6.3) Copyright (C) 2007 Free Software Foundation, Inc. I guess I will try using the shell script wrapper idea, to some more experiments in a more controlled environment. -- John