Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We have a Windows 2000 box running Apache that's running out of disk space. We can't shut down or restart Apache to clear the lock (I'm a UNIX guy, not sure what the equivelant term for Windows is) on the file because it takes too long to restart.

Trying something like

ren access_log access_log.bak

or

del access_log

results in

The process cannot access the file because it is being used by another process.

How do we clear down the file without taking down Apache?

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

Apache is currently using that file, the only real way is to kill the process that the file is being used by, Apache.

You can try using Unlocker on the file and see if you can remove the lock, it could help.

share|improve this answer
add comment

Don't think this will work for Windows 2000 (quick google says PowerShell for Win 2000 is not supported) but I found this forum post that works for me on Win 7, figured I'd share it here for others looking to do the same:

http://hardforum.com/showthread.php?t=1538826

Basically, get yourself a copy of Windows PowerShell and run this command:

while ($true) { gci c:\some\dir -recurse -Include mylogfile.log | ? { $_.length -gt 100mb } | Clear-Content; sleep 15 }

This will truncate the log file every time it grows above 100MB for as long as you let the command run.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.