[Chapter 24] 24.2 Save Space with Bit Bucket Log Files and Mailboxes
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-08-04T21:41:27Z

#

| Chapter 24 Other Ways to Get Disk Space |

## 24.2 Save Space with Bit Bucket Log Files and Mailboxes

Some UNIX programs - usually background or daemon programs - insist on writing a log file. You might not want the log file itself as much as you want the disk space that the log file takes. Here are a few tips:

- Some programs will write to a log file only if the log file exists. If the program isn't running, try removing the log file.

- If you remove a log file and the program recreates it, look for command-line options or a configuration file setup that tells the program not to make the log file.

- If your system has symbolic links (18.4), try replacing the log file with a symbolic link to /dev/null (13.14):

  >     # rm logfile
  >     # ln -s /dev/null logfile

  If you're lucky, the program won't complain and will throw all its messages in the bit bucket. Watch out for programs that run at reboot or from the system crontab (40.12) to truncate and replace the log file. These programs might replace the symbolic link with a small regular file that will start growing again.

- Does a system mailbox for a user like uucp keep getting mail (1.33) that you want to throw away? You may be able to add a .forward file to the account's home directory with this single line:

  >     /dev/null

  Or add an alias in the system mail alias file that does the same thing:

  >     uucp: /dev/null

  If your system has a command like newaliases to rebuild the alias database, don't forget to use it after you make the change.

- JP

24.1 Instead of Removing a File, Empty It |  | 24.3 Unlinking Open Files Isn't a Good Idea