17 Jun, 2008, Pedlar wrote in the 1st comment:
Votes: 0
Heyo, im new to CGI and sh scripts and stuff (im more C++ then this shit ;) )

what im looking to do is make an sh script to kill my MUD the exe is rom, i know how to retrieve the Process but it wont work in a sh script

this is what i have currently that doesnt work, but if i type it in command line it does.

#!/bin/sh
echo Content-type: text/plain
echo


echo "Killing Proccess"
echo `ps xuw | grep -v grep | grep ../src/rom | awk '{print $2}'`

kill -9 `ps xuw | grep -v grep | grep rom | awk '{print $2}'`

echo "starting server again"


Any help would be greatly appreciated
17 Jun, 2008, David Haley wrote in the 2nd comment:
Votes: 0
Maybe if your sig wasn't so long (and silly to boot!) I'd be more inclined to help you. :devil: But the first thing to do is to make the CGI script run the same shell that you use on the command line, and see what happens.
17 Jun, 2008, The_Fury wrote in the 3rd comment:
Votes: 0
The simplest solution is to use the killall command followed by the process name. killall removes the need to go looking for process id's and all the parsing associated with it.

IE, killall smaug

If that script is run by the same user as the owner of the process it will only kill the the smaug processes owned by that user, if run as root it will kill any smaug processes running on that computer.
0.0/3