ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Depending on the particulars of the server you're using and the method it's using for logging you may be able to kill -HUP the process to get it reopen its file handles. Although if it wasn't originally designed for unix/linux it's likely that will disconnect players.
Depending on how the process handles particular signals a HUP may kill and restart it or it may just close and reopen file handles or any variety of other things. Either research it for the individual application or try it while connected and see what happens and if new file handles get opened correctly a after log rotation.
So if im right, your saying that i have to kill the proces, wich means that the server will go offline and restart the server?
mv server.log server.log.1
tail -f server.log.1
the server should still be writing to server.log.1
killall -HUP edited.x86
now look and see if a new server.log got created. If it did, you're golden. You just mv/kill -HUP any time you want to rotate your log.
If it didn't you'll have to try something else.
Most long lived processes interpret sighup as a request to close and reopen the logfile handle, and reread the configuration, if there is one. The idea is that you can have the process perform some housekeeping, without, say, killing connections that are open to it.
nope. Kill doesn't kill processes, it sends signals to processes. Some signals normally cause a process to die. In fact, the _default_ signal that kill sends (if you don't give it one) is SIGTERM (15), which almost always stops the process.
You can send other useful signals to processes using kill also. Signals like USR1 and USR2 are reserved so that you can add a custom signal handler to respond to them. Occasionally people will use USR1 as the log rotation signal, and you'd say 'kill -USR1 12345'.
HUP or "hangup" is leftover from the days of serial comms, and wound up getting co-opted for log rotation (among other things)