I am trying to make a plugin atm and am running into some troubles with how to delete a file while it is in use. The particular file is the server.log and i was wondering if you knew of any round about way to do this. My ideas were something like stopping the server, deleting it, restarting the server, but these brought up more problems for me as to how would the plugin run with the server stopped or even how could it restart the server again when the plugin isn't running. Any help would be appreciated.
As i said, its for a plugin I'm making. Simply put, it will back up the server.log file periodically, time stamp it, then delete the original so as the server.log file doesn't get ridiculously big as I've heard it does sometimes and lag the server. I have finished everything except for the deleting of the server.log which is being a real annoyance.
Shit, well i still wanna make it, i wasn't planning on releasing it. Its soley for helping me learn to actually write them, and also for a friends server. Looking at this one it seems to be a couple builds old so idk i may post it still. Thanks for showing me this, although i cant see a source so i can't learn from what hes done.