public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Script Doesn't Work Correctly with Cron
@ 2002-12-12 10:29 Buck Turgidson
  2002-12-12 10:53 ` Igor Pechtchanski
  0 siblings, 1 reply; 2+ messages in thread
From: Buck Turgidson @ 2002-12-12 10:29 UTC (permalink / raw)
  To: cygwin

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@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



--
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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Script Doesn't Work Correctly with Cron
  2002-12-12 10:29 Script Doesn't Work Correctly with Cron Buck Turgidson
@ 2002-12-12 10:53 ` Igor Pechtchanski
  0 siblings, 0 replies; 2+ messages in thread
From: Igor Pechtchanski @ 2002-12-12 10:53 UTC (permalink / raw)
  To: Buck Turgidson; +Cc: cygwin

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@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"?
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-12-12 18:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-12 10:29 Script Doesn't Work Correctly with Cron Buck Turgidson
2002-12-12 10:53 ` Igor Pechtchanski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).