## 15.3. 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 you can't get the program to stop writing the log file, try replacing the log file with a symbolic link to /dev/null (Section 43.12):

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

  The program won't complain, because it will happily write its log file to /dev/null, which discards everything written to it. (Writing to /dev/null is also known as "throwing it in the bit bucket," since all the bits just go away.) Watch out for programs that run at reboot or those that run from the system crontab (Section 25.2) 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 bin keep getting mail (Section 1.21) 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:

  >     bin: /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

Copyright © 2003 O'Reilly & Associates. All rights reserved.