Re: yum.cron for testing & examination

Ed L Cashin <[email protected]>
Newsgroups gmane.linux.tao.general
Message-ID <[email protected]>
"David L. Parsley" <[email protected]> writes:

> Hi all,
>
> Finally, after chatting w/ Seth about the 'yum hangs' problem, I hear
> that there's really no good solution for python-2.2 based systems, like
> Tao.  Since this problem is really bad in yum.cron (quietly stops your
> server from updating), I've put created a yum.cron with a configurable
> timeout - 12h default, 0 disables.  If you know an easier way to
> accomplish timeouts with bash in a clean way (not leaving cruft
> processes hanging around) let me know.
>
> Anyway, you can read the attached script and try replacing your yum.cron
> with it.  I'm going to test it for a bit before folding it into Tao yum,
> but after some testing with 'set -x' I'm pretty confident it will work.
>
> Feedback welcome - desired even.

David, to keep things simple you could use the timeout feature of
bash's "read" built-in.  

The strategy would be to echo something after successful completion of
the job.  (In the example below, sleep is standing in for the yum
job.)  You pipe the output to read with a timeout in seconds, and if
read doesn't get anything in time, it can do whatever --- print a
diagnostic, for example.


  ecashin@kokone tmp$ sh -c "sleep 2 && echo ok" | \
    { read -t 3 a && echo $a || echo error; }
  ok
  ecashin@kokone tmp$ sh -c "sleep 4 && echo ok" | \
    { read -t 3 a && echo $a || echo error; }
  error



-- 
  Ed L Cashin <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.