[ale] Expect?

Robert L. Harris robert.l.harris at gmail.com
Wed Feb 9 14:59:52 EST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Well,
  Right now I have this:

#!/usr/bin/expect  --
 set timeout 30

while { 1 } {
  spawn /usr/local/streambaby/streambaby
  expect {          
    "java.io.IOException" {
      puts "    *** Killing ***\r"
      system "kill -9 `pgrep -f 'java.*streambaby.jar'` "
      sleep 30
    }
  }
}

The problem is the streambaby process will throw the java.io error but
not die.  I just want to kill it and respawn it, wait for it to die
again.  if I could get the kill command to work I'd be set.

Robert


On 2/9/11 12:43 PM, Lightner, Jeff wrote:
> Expect is a good tool if you're trying to automate things that
> interact with other things but don't have automatic logins setup
> via ssh/scp. I've used it for things like doing telnet to 10 fibre
> bridges we used to have and going through their menus to do
> reboots. On those ssh wasn't an option and their was no way to
> script anything on the bridge itself.
>
> -----Original Message----- From: ale-bounces at ale.org
> [mailto:ale-bounces at ale.org] On Behalf Of Randy Ramsdell Sent:
> Wednesday, February 09, 2011 2:27 PM To: Atlanta Linux Enthusiasts
> Subject: Re: [ale] Expect?
>
> Robert L. Harris wrote:
>>
>> Anyone working with expect? I have a prog that needs to be killed
>> and restarted based on stdout from the prog. I have the spawn
>> and
> detection
>> working, just need the kill -9... -- :wq!
>> ====================================================== Robert L.
>> Harris | GPG Key ID: E344DA3B
>>
>
> I suppose, why expect?
> _______________________________________________ Ale mailing list
> Ale at ale.org http://mail.ale.org/mailman/listinfo/ale See JOBS,
> ANNOUNCE and SCHOOLS lists at http://mail.ale.org/mailman/listinfo
>
> Proud partner. Susan G. Komen for the Cure.
>
> Please consider our environment before printing this e-mail or
> attachments. ---------------------------------- CONFIDENTIALITY
> NOTICE: This e-mail may contain privileged or confidential
> information and is for the sole use of the intended recipient(s).
> If you are not the intended recipient, any disclosure, copying,
> distribution, or use of the contents of this information is
> prohibited and may be unlawful. If you have received this
> electronic transmission in error, please reply immediately to the
> sender that you have received the message in error, and delete it.
> Thank you. ----------------------------------
>
> _______________________________________________ Ale mailing list
> Ale at ale.org http://mail.ale.org/mailman/listinfo/ale See JOBS,
> ANNOUNCE and SCHOOLS lists at http://mail.ale.org/mailman/listinfo

- -- 

:wq!
====================================================================
Robert L. Harris                     | GPG Key ID: E344DA3B
                                         @ x-hkp://pgp.mit.edu
DISCLAIMER:
      These are MY OPINIONS             With Dreams To Be A King,
       ALONE.  I speak for              First One Should Be A Man
       no-one else.                       - Manowar

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iD8DBQFNUvI48+1vMONE2jsRAnr9AJ4uTXJtR7P3Rj1Ktf6sUcd1AXoNBACgtOip
C4+UqZK67n9JFbFWkWQI+jw=
=Tp4t
-----END PGP SIGNATURE-----



More information about the Ale mailing list