Sponsored Content
Top Forums Shell Programming and Scripting Suppressing output of a spawned telnet process Post 302433215 by arun_maffy on Tuesday 29th of June 2010 03:08:31 AM
Old 06-29-2010
In the below sample code I wanted the action "date" not shown to the user.
Code:
#! /usr/local/bin/expect --

set timeout 120
log_user 0

spawn telnet <hostname>

expect "login: $"
send " username\r"
expect "Password: $"
send "password\r"

expect "<prompt> $"
send "date\r"

expect "<prompt> $"
send "exit\r"

interact

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

exit from telnet kills orbix process

Hi, I'm using a bourne shell to kick off a 3rd Pty app. This app uses Orbix. When I exit from the telnet session which started the app or hit CTRL-C at the command line, the orbix process dies, yet all other process remain. I've tried starting the app as a background process, but it still... (1 Reply)
Discussion started by: edgarm
1 Replies

2. Shell Programming and Scripting

Is there any cmd to kill a process including its childs ( or sub processes spawned by

Dear Unix Gurus, Here is my query. If i start a script,it inturn calls many other scripts ..and most of them continue to run in parallel. Suppose,if i want to stop my script for some reason,i need to kill -9 each of the processes running.It becomes clumsy if the sub processes r more. ... (15 Replies)
Discussion started by: gvsreddy_539
15 Replies

3. UNIX for Dummies Questions & Answers

Suppressing output to the screen

I want to check whether the variable read from the console is number or character , so i used echo $option|grep and checked the reuslt returned by grep cmd using $? But since I use echo the value is getting printed in the screen , I want to supress the o/p. Can anyone suggest how this can be... (1 Reply)
Discussion started by: rolex.mp
1 Replies

4. Shell Programming and Scripting

Suppressing the automatic output of "script"

Is there a way to suppress the output that script command displays - "Script command started..." (4 Replies)
Discussion started by: ggayathri
4 Replies

5. UNIX for Dummies Questions & Answers

Finding apache process id that is spawned by a wget

Hi, I have a situation where I am writing a programme that runs a series of long running PHP scripts that can take anything from 20 minutes to 10 hours to execute. I have a solution half implemented where I use via php exec(wget <location to command>) and get the process id back. This... (1 Reply)
Discussion started by: mrploddy
1 Replies

6. Shell Programming and Scripting

Process behavior different when spawned from single terminal

So this one just plain confuses me. I have a bunch of somewhat CPU intensive processes that all communicate using a shared memory region. Some of these programs are threaded and some also change the scheduling to FIFO or round robin. The good news is that everything works as long as I spawn... (3 Replies)
Discussion started by: talkingfennel
3 Replies

7. Shell Programming and Scripting

Storing received value from send, spawned telnet session

Hi Guys, I'm completely new to bash and trying to write a script to spawn a telnet session to retrieve the RSSI value of my device and log the average value of the RSSI over 20 samples. I know that my command does return the RSSI value successfully but my bash scripting is letting me down. I'm... (5 Replies)
Discussion started by: bwkm
5 Replies

8. Shell Programming and Scripting

Redirect the output of the telnet to a file

Hi, I am using cygwin. Below is my script that reads all ip ports for iplist.txt and telnets to it. ( file="iplist.txt" while read line do echo $line echo $(telnet $line) done <"$file" ) > output2.txt ~ while the output2.txt gets the first echo but does not show the second... (2 Replies)
Discussion started by: mohtashims
2 Replies

9. Shell Programming and Scripting

Telnet and get process count

Hi guys, I'm writing a script on a Solaris 10 server (server A) that needs to telnet 2 servers (server B & server C) and get a certain process count from these 2 servers. Then on server A, I check if both counts are greater than 17, I do a sendmail to concerned people. For the telnet part,... (7 Replies)
Discussion started by: frum
7 Replies

10. HP-UX

Suppressing errors from command output

Hi, When I run the command "print_manifest | grep "Main Memory", I get the note : # /opt/ignite/bin/print_manifest | grep "Main Memory" NOTE: Could not read the /etc/resolv.conf file. Main Memory: 196498 MB # How do I suppress the part : NOTE: Could not read the... (4 Replies)
Discussion started by: anaigini45
4 Replies
Systems(4)						     Kernel Interfaces Manual							Systems(4)

NAME
Systems - Contains information about remote systems that can be contacted using the uucp program. SYNOPSIS
/usr/lib/uucp/Systems DESCRIPTION
The /usr/lib/uucp/Systems file contains an entry for each remote system that the local system can communicate with using uucp. The uucp program cannot establish a connection with a remote system unless it has an entry in the Systems file. The Systems files must be config- ured on each system running the uucp program. Note that only someone with root user authority can edit the Systems file, which is owned by the uucp login ID. Fields in the Systems File The Systems file should contain a description of each system that the local system can establish a remote connection with. Each line in the Systems file includes the following fields: sys_name Time Caller Class Phone Login The name of the remote system. In general, names should be a maximum of seven characters in length and must be unique. To insure compati- bility with some older systems, names should only include lowercase characters and digits. There can be more than one entry for each sys_name. Each additional entry for a specific system represents an additional communica- tions path that uucp will sequentially try if communication cannot be established using an earlier entry. Specifies the times when the local system can call the remote system. This field consists of three subfields: day, for the day of the week (required), time, for the time of the day when the system can call (optional), and retry, for the minimum retry period in minutes (optional). The day and time subfields are not separated with spaces. The retry field is separated by a semicolon. The day subfield is specified using the following keywords: system can call on any day system can never call the remote system. The remote system will have to call the local system. any weekday. You can also use Mo, Tu, We, Th, Fr, and Sa, for example MoWeFr, for Monday, Wednesday, and Friday. The day subfield is required, unlike the time and retry fields. The time subfield is specified contains two times, in 24-hour clock notation, which specify a range of times. Leave this subfield blank if the remote system can be called at any time during the day. For example, if a remote system can only be called during the morning, enter 0800-1200 in the subfield. The time subfield can also specify when the remote system cannot be reached if the time range entered spans 0000. For example, 0800-0600 means the remote system can be contacted at any time, except between 6:00 am and 8:00 am. Multiple time fields can be included by using a comma as a separator. For example, WK1800-0600,Sa,Su means the remote system can be contacted at any time on a week day except between 6:00 pm. and 6:00 am, and at any time on Saturday and Sunday. The optional retry subfield, specifies the minimum time, in minutes, before uucp can try again to contact a remote system after an unsuccessful attempt. This subfield is separated from the rest of the string by a semicolon. For example, Any0800-1200;3 specifies that 3 minutes is the minimum period after which uucico can try this system again once it has been invoked explicitly or by the cron daemon. Usually, uucp will attempt to contact the remote system twice and if uucp fails, it will exit. The uucp command can be invoked again after the 3 minute period. Specifies the type of connection to be used to communicate with the remote system. Use the ACU keyword for a telephone connection using a modem or TCP (for a connection using TCP/IP). Alternatively, sys_name can be used for a hardwired connection. If TCP is used, there is a subfield which specifies a conversion protocol. The default is the g protocol. Other protocols are e, f, and t which are faster and more efficient than the g protocol. To specify a particular protocol, place a comma and the protocol letter after TCP, for example TCP,f. The entry specified in this field must have a corresponding entry in the /usr/lib/uucp/Devices file. The speed in bits per second for the device. Unless it is necessary to use a specific baud rate, use the keyword Any. This instructs uucp to match a speed that is appropriate for the ACU of system connection specified in the Caller field. For a telephone connection, the rate you enter in this field should correspond to a rate specified in the Class field of an entry in the /usr/lib/uucp/Devices file. For a TCP connection, do not specify a baud rate. Instead, use a hyphen, -, as a placeholder. The phone number used to reach the remote system. For a hardwired or TCP connection, use a hyphen, -, as a placeholder. The phone number can be the complete phone number of the remote system or a combination of an alphabetic abbreviation that repre- sents the dialing prefix and the remainder of the number; see Dialcodes(4). An equal sign, =, in the phone number indicates a wait for a secondary dial tone. This may be required when a special number sequence must be used to access an outside line, for example. For modems that do not have the ability to detect a secondary dial tone, the = sign generates a pause instead. A hyphen, -, in the phone number generates a 1-second pause. The "chat string" which describes the initial conversation between systems to complete the login procedure. The string consists of "expect-send" pairs (separated by spaces) and optional "subexpect-subsend" pairs (separated by hyphens). The "expect" portion contains characters that the local system expects to receive from the remote system. The "send" portion con- tains a string of characters that are sent to the remote system upon receipt of the "expect" string. For example, the first expect string generally contains the remote system's login prompt, and the first send string generally contains the login ID to be used on the remote system. The second expect string contains the remote password prompt and the second send string contains the remote sys- tem's password. For example, in: uucp word: sysuucp Note that the expect portion in the example contained only the trailing part of the full strings expected, login: and password:, respectively. The expect string only needs to contain part of what is expected. This helps to avoid problems with remote systems that may use Login: or Password: instead of login: and password:. The use of "subexpect-subsend" strings is shown below: in:--in: uucp word: sysuucp In the example, the local system expects to receive the string in:. If the local system gets that string, uucp goes on to the next field in the "expect-send" sequence, which is uucp. However, if the local system does not get that string, it sends its own string, which is enclosed by hyphens after the expect string. In the above example, a null character followed by a newline is sent. The local system then expects the in: (the second instance of it in the example). The newline sent to the remote generally causes it to respond with its login prompt, and the login ID can be sent followed by password processing. The following strings can be included in the Login field: Null character Backspace Suppress the newline at the end of the send string Delay two seconds before sending or reading more characters Pause for approximately .25 to .50 seconds Turn on the echo check (useful in Dialers file) Turn off the echo check (useful in Dialers file) Send a BREAK character Newline Carriage return Space char- acter Tab backslash character EOT character. Two EOT newline characters are sent BREAK character (same as K) Collapse the octal digits (ddd) into a single character before sending. login:--login: uucp word: sysuucp The following example is shown below as two lines due to screen-width limitations. As a typical example entry in Systems, it would actually be one line: host1 Any ACU 1200 ch6412 "" In this example, host1 can be called at any time (Any) using a phone connection (ACU) at 1200 baud. The phone number is ch (which is defined in the Dialcodes file) followed by 6412. Initially, the local system expects nothing (indicated by "") and sends a sequence of four carriage returns with two-second delays separating them ( d d d ). This is typical for a remote system that must read characters before presenting a login prompt. Finally, the login is executed, using login ID uucp and password sysuucp. FILES
Contains information about available devices Contains dial-code abbreviations Contains information about modems used for uucp communica- tions links RELATED INFORMATION
Daemons: uucico(8) Commands: ct(1), cu(1), uutry(1), uucp(1), uucpsetup(8) delim off Systems(4)
All times are GMT -4. The time now is 05:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy