LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 09-07-2005, 04:29 PM   #1
darksoul04
LQ Newbie
 
Registered: Sep 2005
Posts: 3

Rep: Reputation: 0
How to remotely shutdown a process


I want to hire a linux fedora server and run some gameserver's on it. However it must be possible to shut down these servers through a website but I don't know how this is called so I can't google on it (only find remote power switches). Also I am new to linux, but don't have to do a lot.
Got these steps though searching:
Use openssh to start wget on the remote server
use wget to download server files and ftp server
add ftp server and server to rc.conf
restart server

But when processes can only be started though the rc.conf (like autoeutex on windows) how can I only restart 1 gameserver not not the entire machine?

Thanks in Advance.
 
Old 09-07-2005, 04:32 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,397

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
well this just sounds like you need to learn some basic bash and Linux process stuff. you can easily kill and restart processes wherever they come from, don't worry about it. if you are able to use ssh to access the server, tyhere's virtually nothing you can't do there than you could do infront of it, other than kick the thing. you might also like to look at webmin to provide a web based config front end.
 
Old 09-07-2005, 04:39 PM   #3
darksoul04
LQ Newbie
 
Registered: Sep 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by acid_kewpie
well this just sounds like you need to learn some basic bash and Linux process stuff. you can easily kill and restart processes wherever they come from, don't worry about it. if you are able to use ssh to access the server, tyhere's virtually nothing you can't do there than you could do infront of it, other than kick the thing. you might also like to look at webmin to provide a web based config front end.
Yes I ssh with wget is the only thing that comes with the server. However do you or someone else know a script that I can put on the server to shut down a specific process (depending on the user) there must be some default free script for this but can't find it. (Btw setting up apache etc isn't the problem, I currently have apache,php,mysql running on windows but instructions for linux are also on their website).
 
Old 09-07-2005, 05:03 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,397

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
1) stop saying words like "free". This is linux... of course it's free.

2) There is no such script as it's far far too trivial to write a script for. just use the kill command, or pkill. read this manpages for details of their usage.
 
Old 09-07-2005, 05:09 PM   #5
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Depending on what distro you are using and how the services start in the first place you probably have a script in /etc/init.d or /etc/rc.d that will stop and start them in a controlled fashion.
 
Old 09-10-2005, 01:08 PM   #6
darksoul04
LQ Newbie
 
Registered: Sep 2005
Posts: 3

Original Poster
Rep: Reputation: 0
On some other form I got a link to a perl code that could kill a process. Now I need to find something to start it again .
 
Old 09-11-2005, 10:56 PM   #7
bobbyseatbelt
LQ Newbie
 
Registered: Sep 2004
Location: hou
Distribution: slack
Posts: 14

Rep: Reputation: 0
my dear god!! do you even understand what these people are trying to tell you??? if you already have ssh access to the server, then you can simply type a command to kill the process and another command to start it. writing a script to do this would be a waste of time due to how simple the task is. the command to start the process will of course differ depending on what your trying to start and with what options.

ex:


to find the PID (process id):
[root@pi root]# ps ax|grep q3ded
5029 pts/0 R 0:02 ./q3ded
5177 pts/0 S 0:00 grep q3ded

to kill the process:
[root@pi root]# kill -9 5029

now the "q3ded" process is gone:
[root@pi root]# ps ax|grep q3ded
[root@pi root]#

to start it:
[root@pi root]# /path/to/your/game -option1 -option2 -blah -blah


if you REALLY need a script to restart a process, here:

--------------------------
Code:
#!/bin/sh

for i in `ps aux|grep ${USER}|grep ${1}|awk '{print $2}'`;do kill -HUP ${i};done
--------------------------


usage would be "./<scriptname> <process to restart>"

as the previous member said, it would be very helpful if you were a little more familiar with the command line in linux.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how a father process know which child process send the signal SIGCHLD icoming Programming 10 07-20-2010 07:26 AM
Script to shutdown remotely a server dtournas Slackware 3 02-06-2005 02:26 PM
Shutdown the System remotely via PHP-Script? linuxuser2005 Linux - General 2 08-30-2004 11:53 AM
Bash Scripting - child process affecting parent process mthaddon Linux - General 1 05-02-2004 01:19 PM
shutdown process hanging southpawsc Linux - Newbie 1 09-24-2003 02:08 AM


All times are GMT -5. The time now is 01:40 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration