Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-27-2010, 07:17 AM   #1
Soji Antony
Registered: Jul 2010
Posts: 54

Rep: Reputation: 1
/usr/bin/expect : Script to check server load using both expect and bash

Hello...I am trying to make a script that can be used to check server load on a remote server and produces sound on our local machine, when server load exceeds a particular limit.
1. I want to execute command uptime or uptime | awk '{print$10}'on the remote server and store the result in a variable(say x), and later use it in the bash script.

Bash Part
echo $x

/root/Desktop/exp is my expect script
Expect part

spawn ssh
expect "*?assword:*\r"
send "redhat\r"
expect "%"
send "uptime\r"
expect "%"
send "logout"
expect "%"
I thought that echo $x will echo "uptime output in the remote server". But it does not happen.....Please help....Thanks in advance....soji
Old 07-27-2010, 11:27 PM   #2
Soji Antony
Registered: Jul 2010
Posts: 54

Original Poster
Rep: Reputation: 1


expect, script

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Expect script: how do i send function key F12 in an expect script alix123 Programming 4 09-01-2013 09:06 PM
Embed expect in bash script prpednek Linux - General 3 05-15-2010 06:36 AM
can expect be called from within a bash script? johnpaulodonnell Programming 4 06-21-2007 09:42 AM
Combined bash and expect script Paul77 Linux - Software 11 03-08-2007 09:17 AM
SMTP/MX Check Expect Script rk4k Programming 2 02-06-2007 09:36 PM

All times are GMT -5. The time now is 09:05 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration