cron job verification

Mark Komarinski mkomarinski at wayga.org
Wed Feb 2 13:49:01 EST 2005


On Wed, Feb 02, 2005 at 01:34:01PM -0500, Derek Martin wrote:
> On Wed, Feb 02, 2005 at 10:45:31AM -0500, Bob Bell wrote:
> > On Wed, Jan 12, 2005 at 12:15:46AM -0500, Derek Martin wrote:
> > >   #!/bin/sh
> > >   # NEVER start shell scripts as #!/bin/bash -- it can lead to strange
> > >   # and unintended results.
> > 
> > Like what?  I've never had a problem.  If I specifically am using bash
> > features, I always say "/bin/bash", as "/bin/sh" could mean Bourne shell
> > or POSIX shell.
> 
> If you invoke bash as /bin/bash, it will source all your environment
> files (usually just your .bashrc, since normally it won't be invoked
> as a login shell in this manner).  This can cause unintended effects.
 
Based on systems I used to admin, it's best to have your .bashrc and .cshrc
exit immediately if it isn't an interactive login.  The reason we
ran into was a user who wanted to scp a file, but it always failed.  Turned
out that scp would use ssh to start a shell on the remote side and execute
the .cshrc which would output data and corrupt the scp stream.

I don't have access to the machines in question anymore, so I don't remember
what the code was.  Google should be able to assist the curious.

-Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20050202/15e65a6e/attachment.bin


More information about the gnhlug-discuss mailing list