Batch Files and Scripting are Your Friend!
If work with large numbers of computers, you are always looking for ways to automate things. Scripting and batch files are your answer!!
In the Windows world, one way to do this is to write batch files. Batch files are a special type of text file that is filled with DOS like commands. I just wrote a batch file today for one of the servers at HHS. This particular server is running a proxy server for the high school. For some reason, the log rotation is not working properly on the server, so it is just logging continously into one great big log file. As you might expect, this file gets huge fast! Right now I don’t have time to troubleshoot why the log rotation stuff isn’t working (especially since I’d have to take the server off line during the school day, which isn’t an option). So instead, I wrote a little batch file as a work around. The batch file stops the proxy server (which runs as a service). Next it moves the log file to a different directory. Once the log file is in the new directory, it starts another little program that renames the log file so it contains the date and time as part of the name. Finally, the batch file then restarts the service. Obviously, the best solution to my problem is to figure out why the proxy server program isn’t able to do rotate the files like it is supposed to, but my little batch file mimics the behavior quite nicely. The last step is to get the server to run the batch file once a day. To do that, I took advantage of the Windows Scheduling Service. I simply scheduled it to run the batch file once a day, every day, at 11:59 PM.
By the way, the batch file ended up looking something like this:
Sorry, comments for this entry are closed at this time.