LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cat (https://www.linuxquestions.org/questions/linux-newbie-8/cat-447027/)

intervade 05-21-2006 11:05 AM

Cat
 
Ok, I dont know if there is a really newbie question or what, but Im writing the output of a game server to a fifo file with

Code:

cat < server.out | ./hlds_l .... 2> /dev/null 1> /dev/null &
Ok, now, in order to stop the game server, I want to write "quit" to the output or game server buffer which is being directed to server.out, so I need to write "quit" to "server.out"

How can I do this with cat?

uselpa 05-21-2006 11:17 AM

The output is stdout, AKA as descriptor 1. So if you write "1> /dev/null", it's going absolutely nowhere.

intervade 05-21-2006 11:20 AM

Well, me and a buddy were doing this before a while back, working on this thing. And it worked actualy, all we did was write "quit" to server.out, and it stoped the server, so how do I do this?

dubz_444 05-21-2006 11:26 AM

er...
echo quit > server.out

uselpa 05-21-2006 11:26 AM

OK, let's see if I get this. "cat < server.out" is in this case the same as "echo quit". So if you want to write that to a FIFO, what about "echo quit > fifofile"?

intervade 05-21-2006 11:31 AM

didnt, seem to work. But, maybe there is another way, I want to control the game server with a fifo with starting and stopping because looking up the pid is too much work. So last time, me and my buddy, were using a fifo file and writing quit.

Any ideas?

dubz_444 05-21-2006 11:46 AM

what about using job numbers?

kill %1 -- job number 1

intervade 05-21-2006 02:18 PM

Ok, I figured out most of this the commands Ive been using have been working, the problem is, its seeming to take more than one output just to get the first output

if I do

cat > server.out | echo quit

it will echo quit, but I then have to type the command AGAIN when Im in the output of server.out with cat.

so basicly it looks like this

cat > server.out | echo quit
quit

any ideas why this is happening?


All times are GMT -5. The time now is 08:55 AM.