Sponsored Content
Top Forums Shell Programming and Scripting Sudo connect to a remote server and execute scripts in remote server Post 302978420 by venky.b5 on Saturday 30th of July 2016 05:59:07 AM
Old 07-30-2016
Hi,

You can try Like

Code:
HNAME=$(ssh -o StrictHostKeyChecking=no username@Server_address "/bin/uname")
if [ -n "${HNAME}" ];then
   echo "connection established successfully" > path/to/log/file
   ssh -o StrictHostKeyChecking=no username@Server_address << EOF >> path/to/log/file
    sh /path/to/remote/scripts/script_name > /dev/null 2>&1;
   if [ $? -eq 0 ];then
      echo "script executed successfully"
   else
       echo "script not executed"
   fi
EOF
else
     echo "connection unsuccessful" > path/to/log/file
fi

Regard's
Venkat K
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Remote Connect - SCO Open Server

Hello.. Please helppppppp...!!! I am using SCO Open Server version 5.0 at work. I am trying to find a third party software to use on my computer at home which has windows 98 on it to do remote connect to my work. Is there any such software ? I know there is PC ANYWHERE but i don't think it... (2 Replies)
Discussion started by: jackpotp
2 Replies

2. Windows & DOS: Issues & Discussions

Connect to a Remote Sybase Server Through Script.

Hi all, I am trying to connect to Remote Sybase database Server through shell script. I am operating on WindowsXP, connect to Unix(version SunOS: 5.8) The thing is i dont know how to connect to Sybase Server through my script file? Are there any manual pages which can guide me through the... (2 Replies)
Discussion started by: Aparna_k82
2 Replies

3. Shell Programming and Scripting

Connect to a Remote Sybase Server Through Script

Hi all, I am trying to connect to Remote Sybase database Server through shell script. I am operating on WindowsXP, connect to Unix(version SunOS: 5.8) The thing is i dont know how to connect to Sybase Server through my script file? Are there any manual pages which can guide me through the... (3 Replies)
Discussion started by: Aparna_k82
3 Replies

4. Shell Programming and Scripting

Script to connect to a remote server and execute scripts

Hello All I need a script or set of commands which can establish a remote connection with another server and execute some scripts over there. Basically it has to establish the connection with the remote server as an user ,say 'testuser' and then execute the script 'testscript'. and return the... (5 Replies)
Discussion started by: sgbhat
5 Replies

5. Shell Programming and Scripting

Execute scripts on remote server

Hi All, I need to first of all establish a connection to remote unix server non-interactively with the help of a shell script and then connect to oracle database from that server all with this script of mine. Please suggest the best method which could be used to connect to server for executing... (1 Reply)
Discussion started by: m_kapur83
1 Replies

6. UNIX for Dummies Questions & Answers

How do I connect to a remote X11 server ?

Hi, how do I connect to a remote x server? i tried this: startx -display 192.168.0.1:0 # when I do this, it just connects to my own x server i.e I see my own desktop. and export DISPLAY=192.168.0.1:0.0 # when I do this nothing happens. (it doesn't even try to connect, no activity in... (7 Replies)
Discussion started by: uxfuser
7 Replies

7. Red Hat

unable to connect remote server using ssh

hi all i am unable to connect remote server using ssh but i am able to ping the server ssh service is running. (5 Replies)
Discussion started by: nikhil kasar
5 Replies

8. Shell Programming and Scripting

Problem connect to a different server then do sudo login and finally run some scripts and get result

I have to write a shell script in my current linux server and I have to connect to a different server then do sudo login and finally run some scripts residing in a particular directory and get results back. I am starting to write my shell script as below but after I do ssh login it prompts for... (2 Replies)
Discussion started by: Devesh5683
2 Replies

9. AIX

Command to connect to remote AIX server

Hi All, Im looking for a command that can remotely connect to another AIX machine and execute scripts present in that server(Possible scenarios are a complete a restart of 3 servers in a cluster through a single script execution present in one of the servers). Im relatively new to AIX and... (5 Replies)
Discussion started by: Vishakh
5 Replies

10. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

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
CFS(4)							     Kernel Interfaces Manual							    CFS(4)

NAME
cfs - cache file system SYNOPSIS
cfs -s [-rd] [-f partition] cfs -a netaddr [-rd] [-f partition] [mtpt] DESCRIPTION
Cfs is a user-level file server that caches information about remote files onto a local disk. It is normally started by the kernel at boot time, though users may start it manually. Cfs is interposed between the kernel and a network connection to a remote file server to improve the efficiency of access across slow network connections such as modem lines. On each open of a file cfs checks the consistency of cached information and discards any old information for that file. Cfs mounts onto mtpt (default /) after connecting to the file server. The options are: s the connection to the remote file server is on file descriptors 0 and 1. a netaddr dial the destination netaddr to connect to a remote file server. r reformat the cache disk partition. d turn on debugging f partition use file partition as the cache disk partition. All 9P messages except read, clone, and walk (see intro(5)) are passed through cfs unchanged to the remote server. A clone followed imme- diately by a walk is converted into a clwalk. If possible, a read is satisfied by cached data. Otherwise, the file server is queried for any missing data. FILES
/dev/hd0cache Default file used for storing cached data. SOURCE
/sys/src/cmd/cfs CFS(4)
All times are GMT -4. The time now is 07:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy