Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 2008 10:31:13 -0400
From:      John Almberg <jalmberg@identry.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Cron question
Message-ID:  <EAB5D028-A4AF-404F-95C9-557BFC0085D1@identry.com>
In-Reply-To: <DA3E6BB8-7E09-4EDB-9E79-A7FE8832734F@mac.com>
References:  <C615711F-BD11-4AAE-8321-5A93A64863E6@identry.com> <DA3E6BB8-7E09-4EDB-9E79-A7FE8832734F@mac.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>
> ...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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EAB5D028-A4AF-404F-95C9-557BFC0085D1>