Jump to content

Shut Down Process On Another Server


The Little Guy

Recommended Posts

I have 2 servers, one has multiple processes running, and the other has the control panel.

 

on the control panel, I would like to send a command to the other server. the command looks like this:

kill #

 

Where # is the number of the process id.

 

is there any way for me to send a command to that server to shut down that process?

Link to comment
https://forums.phpfreaks.com/topic/194316-shut-down-process-on-another-server/
Share on other sites

You can't simply send the password as the next command, you would need to setup ssh keys (google it). Also note that having root be able to login via ssh poses quite the security risk.

 

Once your keys are setup you would simply use....

 

exec("ssh username@servername commandtoexecute");

What testing have you done? We could go back and forth all day with this lack of information.

 

Test to see if your connection is successful by doing something simpler. eg;

 

exec("ssh [email protected] touch foo");

 

Does this make a file called 'foo' within the user ryannaddyps's home directory on the myserver.com machine?

Your correct I didn't set it up correctly :)

 

I was reading my wiki and it said to create it on my home computer, which I did, but then I thought and realized that I wasn't connecting via my home computer, it was via another web server.

 

so I did it in putty on the websites server where the script runs, and did the process the same..

 

now it creates a file called foo!

 

Now I wan't to see if it does what I meant for it to do.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.