If you must clear the log file, do. cp /dev/null /var/log/file or. echo /var/log/file That truncates the file without closing any open file handles. Edit: Using logrotate to deal with the files is the better long-term solution. Truncating the file should be an emergency measure. · I have hundreds of log files so it would take FOREVER to go through and delete them. I would think there has to be a way to manually run the script that resets the log files at the end of the month. If you're having this problem open a support ticket. Although a command is not provided by default, a simple shell script can be written to remove the Apache log files without causing any possible access conflicts. The script, with which we cannot provide assistance, can be created by issuing the pico -w www.doorway.ru command and pasting in the following: #!/bin/sh. #First stop apache to prevent any possible conflicts while. .
1) Gzip the old file (text files compression ratios are really good). If we assume the file is named /var/log/apache/www.doorway.ru then do this: gzip -c /var/log/apache/www.doorway.ru /var/log/apache/www.doorway.ru 2) Clear the current file. echo /var/log/apache/www.doorway.ru 3) Restart apache. It will consequently be necessary to periodically rotate the log files by moving or deleting the existing logs. This cannot be done while the server is running, because Apache httpd will continue writing to the old log file as long as it holds the file open. Instead, the server must be restarted after the log files are moved or deleted so that. If you must clear the log file, do. cp /dev/null /var/log/file or. echo /var/log/file That truncates the file without closing any open file handles. Edit: Using logrotate to deal with the files is the better long-term solution. Truncating the file should be an emergency measure.
Usrn asked the Desktops forum how to get rid of files that refuse to be deleted By Lincoln Spector, PCWorld | Solutions, Tips and Answers for PC Problems Today's Best Tech Deals Picked by PCWorld's Editors Top Deals On Great Products Picked. This guide provides an overview of Linux log files. It shows where they are located, how to read them and how to rotate the log files. A log file provides a timeline of events for the Linux operating system, applications, and services. The. Some utilities have a “secure delete” option that promises to securely erase a file from your hard drive, removing all traces of it. Older versions of Mac OS X have a “Secure Empty Trash” option that tries to do something similar. Apple rem.
0コメント