Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am writing an expect script to be called by a ksh script. The expect script as expect will automate ssh login, and check for /var/crash (dump) space on the server, and return a value depending on if space is
enough or not.
spawn ssh -o StrictHostKeyChecking=no abc@def
expect "netdump@def's password:"
set result [exec df /var/crash | grep -v Filesystem | grep -v dev | tr -s " " " " | cut -d " " -f4]
puts " the value is $result"
*** The set command shud set result to value of free space on the remote server right ?? But it sets it to the value of free space on the host server. Got no idea why. ***
puts " the value is $result"
Any suggestions ?
I want the exec command to compute this on the remote server. Store the value in $result.
I 'll pass an argument to this expect script which is min free space.
I can then compare these two and return 0 if the server has enuf space and 1 if not .
true .. that is an option..
But since I'm along this path..
I dont understand why the set result [ .. ] line is executing the df command on the local host rather than remote ? The ssh session has already been spawned and authenticated by now.
Does the exec command force it to do on the local host ??
It looks like you are trying to run a tcl command which I don't think will work. You still have to send the command to the remote system. I think you have to play with the escape chars but this might get you going in the right direction.
send "df /var/crash | grep -v Filesystem | grep -v dev | tr -s \" \" \" \" | cut -d \" \" -f4\r"
set result $expect_out(buffer)