From owner-freebsd-isp Tue May 15 0: 6:37 2001 Delivered-To: freebsd-isp@freebsd.org Received: from krijt.livens.net (213-193-182-127.adsl.easynet.be [213.193.182.127]) by hub.freebsd.org (Postfix) with ESMTP id CB6FA37B423 for ; Tue, 15 May 2001 00:06:33 -0700 (PDT) (envelope-from wim@krijt.livens.net) Received: (from wim@localhost) by krijt.livens.net (8.11.3/8.11.3) id f4F76jI26669; Tue, 15 May 2001 09:06:45 +0200 (CEST) (envelope-from wim) Date: Tue, 15 May 2001 09:05:25 +0200 From: Wim Livens To: freebsd-isp@freebsd.org Cc: davew@sai.co.za Subject: RE: Telnet + command scripting run from crond Message-ID: <20010515090524.A26629@krijt.livens.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Something like this works for me. Customize it to your device. Do it by hand once to see what exact prompts you need to expect. #!/usr/local/bin/expect spawn telnet your_nas expect Username: send "foo\n" expect Password: send "bar\n" expect # send "some command\n" expect # send "exit\n" interact -- Wim Livens. IP Network Engineering. C o l t B e l g i u m -----Original Message----- From: David Wilson [mailto:davew@sai.co.za] Sent: Monday, May 14, 2001 5:39 PM To: freebsd-isp@freebsd.org Cc: isp linux Subject: Telnet + command scripting run from crond Hi all, howzit going ? I'm not to good at scripting so I really need help on this: I have a USR NAS device that I need to telnet every 24 hrs and issue a command to it, how could I write a script that I could run as a cron job that would automatically login and issue the commands and then log out again ? Thanks. Any help would be greatly appreciated. Regards David Wilson Technical Support Centre The S.A Internet 0860 100 869 http://www.sai.co.za To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message