Re: bash basics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 23, 2002 at 11:00:56AM +0200, H M Kunzmann wrote:
> I have the following two scripts (below) that I've gotten a bit confused
> with.
> 
> What I want to do is dump a daily log of the router ip accounting into a
> text file for that day.
> 
> The bash script 'runlog' runs the expect scripts 'commands'.
> 
> If I run '#expect commands' I get the output I want.
> If I run 'runlog' the process runs through once and then stop
> responding, and doesn't iterate.
> 
> I ended up writing the runlog script because a cron job for 'expect
> commands >> logfile' did not run, but did create the file.
> 
> I'm a bit lost and a nudge in the right direction would be greatly
> appreciated.
> 
> 
> #!/bin/bash
> 
> today=/logs/$(date +%Y-%m-%d)$1.log
> 
> #echo Starting Router log...
> expect -f /root/commands >> $today
> 
> echo Completed router log for $today. Sleeping for 10 minutes.
> sleep 10m
> exec /root/runlog

Is the above script "/root/runlog"?  If it is, then it appears that you are
recursively calling that script, which is probably something you don't want
to do.  Instead I would recommend calling this strip from cron on whatever
frequency you wish.

- jkt

-- 
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*
Jay Turner, QA Manager          jkt@redhat.com               Red Hat, Inc. 

      No amount of experimentation can ever prove me right;
      a single experiment can prove me wrong.   -- Albert Einstein 



-- 
Psyche-list mailing list
Psyche-list@redhat.com
https://listman.redhat.com/mailman/listinfo/psyche-list

[Index of Archives]     [Fedora General Discussion]     [Red Hat General Discussion]     [Centos]     [Kernel]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux