Execute command from terminal on remote machine


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Execute command from terminal on remote machine
# 1  
Old 10-09-2007
Execute command from terminal on remote machine

Hi All,

I want to execute some commands on unix machine from the mac machne. I have two options for doing so, I am confused which is the best way of doing. Here are two options.

Requirement:
Execute command on the remote server machine. Commands to be executed itself contain arguments to be passed to some script.

Option1:
1. Perl script to do ssh and expect to connect to the remote machine and execute command over there.
Complexity/Overhead: If I need to execute any new command, I have to overwrite '.exp' file.

2. Use Net::SSH:Expect perl module to do so.
Complexity/Overhead: Bit difficult to install perl module on mac os. Smilie

I am confused here which is the best option which suite my requirement.

Will appreciate any guidance.

Thanks,
Ranu
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies

2. Shell Programming and Scripting

How can I execute local script on remote machine and include arguments?

I have a script in local server cd /home/dell/work/BOP/testdir ./processchk po (here processchk is a script & po is passed as an argument) Now I want to execute this script from remote server ssh $username@$hostname "cd /home/dell/work/BOP/testdir; ./processchk po" But Its getting error... (9 Replies)
Discussion started by: manohar2013
9 Replies

3. Shell Programming and Scripting

Execute shell script on remote machine

I want to execute a shell script(set of commands) on remote machine and that script takes input from text file(local machine). Please refer below: ssh user@hostname 'bash -s'< ./test.sh file.txt But i got the error file.txt doesn't exist. Can anyone help me on this. Content of test.sh: ... (2 Replies)
Discussion started by: manishtri88
2 Replies

4. UNIX for Dummies Questions & Answers

Execute shell script in remote machine

Hi All, We have 2 servers A and B. B is having a sctipt called b.sh in path /home/dev/scripts. Now my requirement is i want to execute b.sh from server A. Kindly help me. (3 Replies)
Discussion started by: Girish19
3 Replies

5. IP Networking

Execute script located on a remote machine

So, is there way of automating this ? My ultimate goal is to run some cmd script in windows and it should connect to a remote unix host and run a script x.sh located on the remote unix host. I was wanting to achieve this by using WinSCP and Putty only. If possible let me know how and if not... (25 Replies)
Discussion started by: mohtashims
25 Replies

6. Shell Programming and Scripting

Change user on remote machine and execute script!

Hi, I need to login into remote server and execute a shell script over there. As of now i am making use of ssh command ssh primUser@135.254.242.2 sh /poll.sh I am logging in as primUser but unless i change the user to root the script execution on the remote machine is not possible. ... (5 Replies)
Discussion started by: goutham4u
5 Replies

7. SCO

Execute command in remote

Hi, How to execute unix commands in remote unix servers? Thanks, Pintu (2 Replies)
Discussion started by: pintupatro
2 Replies

8. Shell Programming and Scripting

how to execute a script on remote machine

hi unix guru's i am new to unix shell programming. i found a trouble in executing a script(bali.ksh) which is available on serverA with username xyza, this script contains sqlplus command to retrive the data from the database available on other serverC. Now i need to run the above script... (4 Replies)
Discussion started by: balireddy_77
4 Replies

9. UNIX for Dummies Questions & Answers

execute a command in remote

how exec a command (ex. a cut or grep ) in anoter pc i have IP address, login and password. (another account of unix system) what's the sintax of command ??? es. my ip is 192.xx.xx.xx i make a exec of "ls" redirect in outpu file (> "file) in another pc ( ip 192.44.55.2xxx) (3 Replies)
Discussion started by: ZINGARO
3 Replies

10. UNIX for Dummies Questions & Answers

Plz Help : How to use write command to execute command on some other terminal

Hi Group , I m trying to execute commands on some other system using write command but inspite of executing the commands they r passed as simple messages. - i m writing >write user-id ! ls o ctrl-d inspite of executing the command ls,other terminal shows ! ls. Thnx in advance. (2 Replies)
Discussion started by: Aashish
2 Replies
Login or Register to Ask a Question
cmexec(1m)																cmexec(1m)

NAME
cmexec - Execute process on a remote Serviceguard node. SYNOPSIS
cmexec node_name [-o outfile] [-t timeout] {[command] | [-k cmd_label]} DESCRIPTION
cmexec will execute a process on a remote Serviceguard node and return any output or return value. cmexec is limited in several ways. cmexec is best suited for situations where other remote execution facilities are not available. For a more full featured tool for remote execution within a cluster, see cexec(1m) provided by Distributed Systems Administration Utilities. To use this command, the local user must have the root access role on the remote node. For more information on Serviceguard access control policies, see the manual, Managing Serviceguard. The command will be executed in an environment which matches the local node. All environment variables defined locally will be available on the remote node. Output from stderr and stdout for the remote process will be combined and delivered in one transmission. This command should not be used for interactive commands or commands which will return large quantities of output. Input via stdin is not supported. Killing the cmexec process does not stop the remote execution of the command. cmexec should not be used on any command which may hang without specifying a timeout value. Options And Arguments cmexec supports the following arguments: -o outfile Write output to the specified file instead of stdout. -t timeout Kill the executed command if it does not exit within the specified timeout (in seconds) node_name Serviceguard node to execute command on. command Command to execute on remote node. May be quoted. -k cmd_label This option is only supported for applications provided by Hewlett-Packard. RETURN VALUE
cmexec returns the exit value for the remote command or 1 if there was an error communicating with the Serviceguard node. EXAMPLES
Execute an 'ls' in a remote directory. cmexec node ls /tmp AUTHOR
cmexec was developed by HP. SEE ALSO
rsh(1), ssh(1), cexec(1m), cmcp(1m), cmdo(1m), cmsync(1m), cmquerycl(1m), cmviewcl(1m) Requires Optional Serviceguard Software cmexec(1m)