Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Thu, 12 Dec 2002 17:04:53 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Eric De La Cruz Lugo cc: cygwin AT cygwin DOT com Subject: Re: Shell script wont run with cron, but it works ok in the command line. In-Reply-To: <20021212215531.70082.qmail@web21407.mail.yahoo.com> Message-ID: Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Try adding "c:\cygwin\bin" to your *system* (not user) PATH environment variable (in the Control Panel System applet select the Advanced tab, then Environment Variables, and change the System PATH variable to contain the above). If you have any other POSIX-compliant toolset installed and in your path, make sure the cygwin bin directory precedes that. As for making the files executable by SYSTEM, "chmod a+x /bin/*" should do it. As a side note, it's always a good idea to use absolute paths in scripts (i.e. /bin/rm) if you are uncertain what the value of PATH may be when the script executes. Igor On Thu, 12 Dec 2002, Eric De La Cruz Lugo wrote: > How can I make the mv, and rm commands excecutable by system? where I > can add the path to this commands for System??? > > This is the hint I have been looking for since Dec 07!!!! > > thanks in advance! > > Eric. > > > Re: Script Doesn't Work Correctly with Cron > From: Igor Pechtchanski edu> > To: Buck Turgidson > Cc: cygwin at cygwin dot com > Date: Thu, 12 Dec 2002 13:26:48 -0500 (EST) > Subject: Re: Script Doesn't Work Correctly with Cron > Reply-to: cygwin at cygwin dot com > > -------------------------------------------------------------------------------- > > On Thu, 12 Dec 2002, Buck Turgidson wrote: > > > I have a script that works when I run it from the command line, but when it > > is executed with cron, it produces a null file. I am sure that cron is > > executing it because it creates the file. It is just not populated. > > > > Here is the script. I want to query an Oracle database every couple of > > minutes, capture some data, and append it to a flat file. I want to keep > > 2000 lines in the flat file. > > > > Can someone spot the error? Again, it works run from the command line. > > > > #!/bin/bash > > sqlplus -s scott AT mydb < up @ss.sql | grep -v "Enter password:" >> monsql.lst > > tail -2000 monsql.lst > montemp.lst > > rm -f monsql.lst > > mv montemp.lst monsql.lst > > This is probably not cron-specific, but try redirecting stderr to a file > (by using "2>filename") to see if the script produces any errors. > Also, are all the programs you use (sqlplus, grep, tail, rm, mv) in the > path for the user that cron runs as (most likely "system")? Are they > executable by "system"? -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk! -- /usr/games/fortune -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/