11-07-2016
How to keep staying on remote server after executing a shell script with if then exit end statement?
i have a "if .. then exit end " in s shell script on remote servers.
now the connection to the remote server got killed after i run this script on the remote servers. How do i run this script on remote hosts and still keep remote connections alive after executing the script.
Thank you.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi
i am having two servers one is local and remote(FTP)server.from local server i have to connect to remote server and execute a shell script
i want to run a shell script(remote location) from my local server
i am having some knowledge on ftp but i am not getting the result .please give ... (2 Replies)
Discussion started by: srivsn
2 Replies
2. Shell Programming and Scripting
Hi,
I have a piece of shell script which will connect to mysql database and execute a load statement(which will load datas in a file to the database table).The code is working and the data is in the tables.
Now my requirement is, i need to grab the output from the load statement... (4 Replies)
Discussion started by: DILEEP410
4 Replies
3. Shell Programming and Scripting
hi,
I am using the below line to run a script from remote server(say server A) to another server(say server B).
ssh username@servername ksh script name.
The issue is the script logs into server B, executes the script on server B, transfers the file to server A but does not exit from... (4 Replies)
Discussion started by: yohasini
4 Replies
4. Shell Programming and Scripting
Hello,
I am running in to a problem running a perl script on a remote server.
I can run a simple script test.pl which contains just a print statment without issue by running
ssh root@1.2.3.4 perl test.pl
However, I have a more complex script that does not execute as expected. I think I... (3 Replies)
Discussion started by: colinireland
3 Replies
5. Shell Programming and Scripting
I have a command that I want to run on machine B from machine A. If I run the command on machine B locally, it works fine.
Here is the command:
for n in `find /data1/ -name 'ini*.ext'` ; do echo cp $n "`dirname $n `/` basename $n
.ext`"; done
From machine A, I issue this command ... (3 Replies)
Discussion started by: dirtyd0ggy
3 Replies
6. UNIX for Dummies Questions & Answers
Hi All,
I have 2 servers A and B. I need to connect to server B from server A and execute a shell script in B which will create some files and i need to copy those files back to server A.
Required easiest possible for perfoming above task. (1 Reply)
Discussion started by: Girish19
1 Replies
7. UNIX for Dummies Questions & Answers
Hi All,
I have one shell script start.sh which executes another shell script test.sh something like below :test.sh -param1 -param2
In the test.sh there is one command for removing file:rm file1.bak
I want whenever I execute start.sh, it will execute test.sh and if it finds string rm... (7 Replies)
Discussion started by: ORAI
7 Replies
8. Shell Programming and Scripting
Hi,
I am writing shell script to automate few use cases for CLI interface. We have CLI interface which has bunch of commands. I am trying to execute one of the commands 'exit' as part of automation to exit from CLI object (not from shell script) in my shell script.
My intension is to execute... (4 Replies)
Discussion started by: Mahesh Desai
4 Replies
9. Shell Programming and Scripting
I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code
TARFILE=${NAME}.tar
TARGZFILE=${NAME}.tar.gz
ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies
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)