public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] autoexpect?
@ 2005-11-25 18:44 Antoine
  2005-11-25 19:00 ` Andres Becerra Sandoval
  2005-11-25 19:00 ` Rob Oravec
  0 siblings, 2 replies; 5+ messages in thread
From: Antoine @ 2005-11-25 18:44 UTC (permalink / raw
  To: gentoo-user

Hi,
I would like to write a script to log in to a network machine and run 
halt (for the missus, who doesn't really like logging in via ssh just to 
turn of the internet connection...), and saw that autoexpect looks like 
it would fit the bill. It doesn't seem to be in portage and it seems a 
lot more difficult with expect...
Any ideas?
Cheers
Antoine
-- 
gentoo-user@gentoo.org mailing list



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

* Re: [gentoo-user] autoexpect?
  2005-11-25 18:44 [gentoo-user] autoexpect? Antoine
@ 2005-11-25 19:00 ` Andres Becerra Sandoval
  2005-11-27  7:29   ` Walter Dnes
  2005-11-25 19:00 ` Rob Oravec
  1 sibling, 1 reply; 5+ messages in thread
From: Andres Becerra Sandoval @ 2005-11-25 19:00 UTC (permalink / raw
  To: gentoo-user

Hello,

If you create a private-public pair with ssh-keygen you can access to
the other machine without a password. Then your script would call ssh
and probably "sudo /sbin/poweroff" as a parameter to halt the remote
machine.


On 11/25/05, Antoine <melser.anton@gmail.com> wrote:
> Hi,
> I would like to write a script to log in to a network machine and run
> halt (for the missus, who doesn't really like logging in via ssh just to
> turn of the internet connection...), and saw that autoexpect looks like
> it would fit the bill. It doesn't seem to be in portage and it seems a
> lot more difficult with expect...
> Any ideas?
> Cheers
> Antoine
> --
> gentoo-user@gentoo.org mailing list
>
>


--
Andres Becerra Sandoval

-- 
gentoo-user@gentoo.org mailing list



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

* Re: [gentoo-user] autoexpect?
  2005-11-25 18:44 [gentoo-user] autoexpect? Antoine
  2005-11-25 19:00 ` Andres Becerra Sandoval
@ 2005-11-25 19:00 ` Rob Oravec
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Oravec @ 2005-11-25 19:00 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 714 bytes --]

On Fri, 2005-11-25 at 19:44 +0100, Antoine wrote:
> Hi,
> I would like to write a script to log in to a network machine and run 
> halt (for the missus, who doesn't really like logging in via ssh just to 
> turn of the internet connection...), and saw that autoexpect looks like 
> it would fit the bill. It doesn't seem to be in portage and it seems a 
> lot more difficult with expect...
> Any ideas?
> Cheers
> Antoine

Hi,

I haven't used autoexpect but have Expect.
Here is a link that you may have seen but will do what you would
"expect"...pardon the pun.

Perl with Expect module or Just Expect on its own.

http://www.infocopter.com/perl_corner/expect.htm

Hope this helps,

Rob


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-user] autoexpect?
  2005-11-25 19:00 ` Andres Becerra Sandoval
@ 2005-11-27  7:29   ` Walter Dnes
  2005-11-27 17:29     ` Solved - " Antoine
  0 siblings, 1 reply; 5+ messages in thread
From: Walter Dnes @ 2005-11-27  7:29 UTC (permalink / raw
  To: gentoo-user

On Fri, Nov 25, 2005 at 08:00:09PM +0100, Andres Becerra Sandoval wrote

> If you create a private-public pair with ssh-keygen you can access to
> the other machine without a password. Then your script would call ssh
> and probably "sudo /sbin/poweroff" as a parameter to halt the remote
> machine.

  That's exactly what I do.  I turn on my emergency system every couple
of weeks, "emerge --sync" and "emerge --ask --deep --update --world",
run etc-update if necessary and then shut down.  I have a honking big
19" CRT on my desk at home, and the KVM is used elsewhere.  The machine
name is m450 (450 mhz PIII).  My main machine is m3000 (AMD64 3000+).
There is an ordinary user "waltdnes" on m450.  /etc/sudoers on m450
contains the following line...

waltdnes  m450 = (root) NOPASSWD: /sbin/poweroff

  I have a short script ~/bin/stopm450 on m3000 ...

#!/bin/bash
ssh waltdnes@m450 sudo /sbin/poweroff

  To shut down...
  1) via ssh shut down unnecessary programs on m450
  2) exit all ssh sessions to m450
  3) stopm450

-- 
Walter Dnes <waltdnes@waltdnes.org> In linux /sbin/init is Job #1
My musings on technology and security at http://tech_sec.blog.ca
-- 
gentoo-user@gentoo.org mailing list



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

* Solved - Re: [gentoo-user] autoexpect?
  2005-11-27  7:29   ` Walter Dnes
@ 2005-11-27 17:29     ` Antoine
  0 siblings, 0 replies; 5+ messages in thread
From: Antoine @ 2005-11-27 17:29 UTC (permalink / raw
  To: gentoo-user

Walter Dnes wrote:
> On Fri, Nov 25, 2005 at 08:00:09PM +0100, Andres Becerra Sandoval wrote
> 
> 
>>If you create a private-public pair with ssh-keygen you can access to
>>the other machine without a password. Then your script would call ssh
>>and probably "sudo /sbin/poweroff" as a parameter to halt the remote
>>machine.

Thanks for all your suggestions, as I basically wanted to create an icon 
on the desktop to turn off the firewall/server, I went with expect. I 
also discovered cygwin on my journeys so am very happy - I just have a 
single script for all systems.
I didn't read the docs carefully enough, and didn't see that autoexpect 
is just a script, so downloading from the expect site + gentoo expect 
solved it for gentoo.
Cheers
Antoine
-- 
gentoo-user@gentoo.org mailing list



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

end of thread, other threads:[~2005-11-27 17:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-25 18:44 [gentoo-user] autoexpect? Antoine
2005-11-25 19:00 ` Andres Becerra Sandoval
2005-11-27  7:29   ` Walter Dnes
2005-11-27 17:29     ` Solved - " Antoine
2005-11-25 19:00 ` Rob Oravec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox