I got that figured out, right now I am trying to do a foreach loop, I want this script to read a file that have some hosts in it and save the config for each one:
Hello to all...this is my first post (so please go easy). :)
I feel pretty solid at expect scripting, but I'm running into an issue that I'm not able to wrap my head around. I wrote a script that is a little advanced for logging into a remote Linux machine and changing text in a file using sed.... (2 Replies)
hi, everyone:
I just wonder how to save the output of command, I mean everything, save as a string into a variable.
another question is I try to ls the details of a directory, but it works in the shell, not in the script.
for example
code: ls -ltr *se100* | grep ^- | tail -1 | awk '... (1 Reply)
This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
I have an Expect script which works very well. It logs into my remote routers and runs some commands and then to the next until finished. I need two things, first I need to save the output to a file from where the log_user 1 begins.
expect << EOF
set timeout 15
#set var "exit "
match_max... (1 Reply)
Hi,
I'm trying to save a crontab configuration using SSH, acessing a Linux machine from a Windows desktop.
So, in the prompt I type "crontab -e", to edit crontab, and a window is opened.
But after writing the changes, I press Save button but it seems not working, because when... (1 Reply)
Hey all. Sometimes I'm tasked to change some router configs for the entire network (over 3,000 Cisco routers). Most of the time its a global config parameter so its done with a loop and an IP list as its the same configuration change for all routers. This is working OK.
However, sometimes an... (3 Replies)
Hey everyone,
I have a few question.
1. Is it possible to display cisco 'show run' output command to the application ??
2. And is there any ways to log in to the router instead of using telnet from telnet application???
Thanks in advance (0 Replies)
Hello C specialists,
I'm trying to write a program to read out a binary configuration file produced by a router.
But the output of Name and Value is cryptic. What's going wrong?
The structure of the binary file is very simple:
struct nvram_tuple {
char *name;
char *value;
... (5 Replies)
Hi,
For some reason I was needed to ping some URL and save the output to a file through Expect script, following is a very basic of that script, but it fails everytime. When I just copied the same 'ping' line to normal Terminal and run, it runs fine. Please, help.
#!/bin/sh
spawn ping -c 3... (1 Reply)
I'm fairly new to scripting so this might not be possible.
I am using Expect with Cisco switches and need to capture the string after finding the expect request. For example, when I issue "show version" on a Nexus switch, I'm looking to capture the current firmware version:
#show version
... (0 Replies)
Discussion started by: IBGaryA
0 Replies
LEARN ABOUT HPUX
dtsdate
dtsdate(1m)dtsdate(1m)NAME
dtsdate - Sets local clock from a remote dtsd server host
SYNOPSIS
dtsdate [-q] [-s] [-u] remote_host [nsecs]
ARGUMENTS
Queries the difference in time between the local host and the remote host, but does not change the local clock. The returned result (2 if
the time would have been reset, 1 if there was an error, and 0 otherwise) can be used by a script to determine what action to take. Causes
dtsdate to work silently, without showing the time. Shows the time in UTC, rather than in the current time zone. The name or the IP
address of a remote host that has a dtsd server. An integer giving the number of seconds by which the remote and local host times can dif-
fer, without the local host's clock being reset. If nsecs is 0, or if it is not specified, it is treated as if it were extremely large,
and no resetting occurs.
DESCRIPTION
The dtsdate command sets the local clock of a system to be the same as the host remote_host, running a dtsd server. The purpose of dtsdate
is to ensure that clock skew is minimized at initial cell configuration or at host instantiation, because it is difficult to start DCE and
its components if the skew is too great.
Clocks among all DCE components must be within five minutes of each other, to prevent failure of CDS and of security. Some DCE components
have even more stringent requirements. For instance, a DFS file server cannot start if its local host differs from other DFS hosts by more
than ten seconds.
The dtsdate command can be used for adjusting a clock backwards, before DCE is running on a host. Adjusting a clock backwards while DCE is
running can cause many difficulties, because security and file system software generally require system time to increase monotonically.
NOTES
The remote host must be running as a DTS server. This means that the dtsd on that system must have registered the DTS management inter-
face, because dtsdate uses the management call to get the current time from that host.
For dtsdate to be able to set the clock, it must run as a privileged user (root).
EXIT VALUE
If the -q argument is given, dtsdate returns 2 if the remote time and local time differ by more than nsecs, 1 if there was an error, and 0
otherwise.
If the -q argument is not given, dtsdate returns 1 if there was an error, and 0 otherwise.
EXAMPLES
With only the host argument:
dtsdate remotehost
dtsdate prints out the time on the remote host.
In this example:
dtsdate -s -q remotehost 10
dtsdate does not print out the remote host's time. If the times differ by more than 10 seconds, it returns the value of 1, otherwise 0.
In the next example:
dtsdate -s remotehost 10 dtsdate sets the clock if it differed from the remote clock by more than 10 seconds. It does this work
silently, because of the -s option.
The following example shows a shell script that uses the return value of dtsdate:
dtsdate -s -q remhost 10
result = $?
if [ $result -eq 0 ] ; then
echo "Time is within tolerence."
elif [ $result -eq 1 ] ; then
echo "Could not contact remote host." >&2
else # result = 2
if dtsdate remhost 10; then # it failed!
echo "Could not set the clock." >&2
fi
fi
RELATED INFORMATION
Commands: dtsd(1m)dtsdate(1m)