Killing a process which is running in different server


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Killing a process which is running in different server
# 1  
Old 11-08-2011
Killing a process which is running in different server

Consider two servers tst01 and tst02.
i need to log in tst01 and check for the processes which run in tst02.
then based on pid , i need to kill that process.

is it possible to achieve?
I am able to connect to tst02 using ftp.
But the problem is, if i use ps it says invalid command.

How i can overcome this and start and stop processes which are in different servers?
thanks
# 2  
Old 11-08-2011
This can be done using ssh command ..
Code:
$ ssh user@tst02 "kill -9 process_id"

Guide : SSH Tutorial for Linux - Support Documentation
# 3  
Old 11-08-2011
Quote:
Originally Posted by jayan_jay
This can be done using ssh command ..
Code:
$ ssh user@tst02 "kill -9 process_id"

Guide : SSH Tutorial for Linux - Support Documentation

yes!.
But each time i am doing ssh, it asks for password.
for example, if i execute,

ssh usr@tst02 "ps -ef"

this asks for usr@tst02 's password:

After entering password, it's listing the processes.

One more thing, i am not able to execute scripts using ssh.

I have tried:

ssh usr@tst02 "./usr/path/scr/scrname.sh"

It says ./usr/path/scr/scrname.sh not found.

Is it possible to automate in the script without entering password?

Thanks
# 4  
Old 11-08-2011
for password less login using ssh pls check this link.

ssh-keygen: password-less SSH login

Also pls correct the syntax

PHP Code:
ssh usr@tst02 "./usr/path/scr/scrname.sh"

correct one 
 
ssh usr
@tst02 "/usr/path/scr/scrname.sh" 
. means you are searching from currect directory
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Killing the process if running for long time in script

I am running a script which will read the data from fail line by line and call the Java program by providing the arguments from the each line. The Java code is working fast for few records and for some records its getting hanged not providing response for morethan one hour. Currently am... (4 Replies)
Discussion started by: dineshaila
4 Replies

2. Shell Programming and Scripting

Killing process on remote server

Hi guys, I am trying to write a script that logs into a remote server as root and greps a particular process, awks its PID and then xargs kill -9 . This is the actual command : for i in `cat nodes.txt` do ssh root@$i 'ps -ef | grep puppet | grep -v grep | awk "{print $2}" | xargs kill... (7 Replies)
Discussion started by: Junaid Subhani
7 Replies

3. Shell Programming and Scripting

Killing a bash process and running the second part of script

I want to run a script that calls remote ssh and if it gets hung, I want to be able to kill that part of the script and run another command in the script for example I have a statement like this: if ]; then export tapes=$(for tape in $(su - nacct -c 'ssh remote1 "cat... (1 Reply)
Discussion started by: newbie2010
1 Replies

4. UNIX for Dummies Questions & Answers

Help with killing / running ( minecraft )

alright, i have been trying to kill a process for some time now and im having a hard time to close it. im not sure if anyone on here is familiar with Minecraft, but im running a server from LimestoneNetworks, i had one of my friends set it up since im not as good as he is with linux, he tryed... (13 Replies)
Discussion started by: tWkiLler96
13 Replies

5. Shell Programming and Scripting

Usage of NOHUP - How to keep the child process running even if I close the Server connection

Hi. ! When I use the 'NOHUP' along with the '&', the process will be running in the background. Even when I attempt to close (Meaning 'EXIT') the session (say PUTTY in this case), it wont exit unless the process is completed. But, say when I forcefully terminate the session (SHUT DOWN the... (2 Replies)
Discussion started by: WinBarani
2 Replies

6. Shell Programming and Scripting

Finding the age of a unix process, killing old processes, killing zombie processes

I had issues with processes locking up. This script checks for processes and kills them if they are older than a certain time. Its uses some functions you'll need to define or remove, like slog() which I use for logging, and is_running() which checks if this script is already running so you can... (0 Replies)
Discussion started by: sukerman
0 Replies

7. Shell Programming and Scripting

script to monitor process running on server and posting a mail if any process is dead

Hello all, I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted. Thanks in advance Regards, pradeep kulkarni. :mad: (13 Replies)
Discussion started by: pradeepmacha
13 Replies

8. Shell Programming and Scripting

Killing of a process and send a mail if the process doesnot come up within 2 minutes

Hi Friends, I am new to this forum as well as new to shell scripting. I have a problem here and i need someone to solve this. Let us consider there are two processes(abc & def).There is a script which kills these two processes(i.e killtheprocess abc). Here abc is the argument . There is a... (1 Reply)
Discussion started by: Prince89
1 Replies

9. UNIX for Advanced & Expert Users

how to check if a process is running in a server from shell script.

I want to write a unix shell script that will check if a process (say debu) is running in the server or not. If no , then send a mail to the corresponding person to start the process??? (2 Replies)
Discussion started by: debu
2 Replies

10. Shell Programming and Scripting

how to get the list of process running in the server from the local machin n unix ?

how to get the list of process running in the server from the local machin n unix ? (3 Replies)
Discussion started by: guhas
3 Replies
Login or Register to Ask a Question