Slaptijack Title

Mutt: Deleting Messages Older Than 30 Days

by Scott Hebert

Mutt LogoI tend to clear out large chunks of email all at once. The most common thing I do is clear out all mail older than 30 days.

In mutt do the following:

  • Shift-D to delete messages matching a pattern. This will return a prompt that says Delete messages matching:.
  • ~d > 30d to delete messages older than 30 days.
  • Enjoy the extra disk space you just created.

Puppet + Augeas: Modify Logrotate Configuration

by Scott Hebert

PuppetOn my web server, I keep my web sites in /var/lib/www. Each web site has a dedicated logs directory. Since logrotate is already rotating Apache logs on the server, I'd like to continue using that to rotate these log files as well. Below, is a Puppet snippet that uses Augeas to modify the stock Debian logrotate configuration file for Apache to include my custom log directories.

augeas { "apache2/logging/sites":
    lens    => "Logrotate.lns",
    incl    => "/etc/logrotate.d/apache2",
    changes => [
        "ins file after rule[file='/var/log/apache2/*.log']/file[last()]",
        "set rule[file='/var/log/apache2/*.log']/file[last()] '/var/lib/www/*/logs/*_log'",
    ],
    onlyif  => "match rule[file='/var/log/apache2/*.log']/file[.='/var/lib/www/*/logs/*_log'] size == 0",
    require => Noop["apache/installed"],
    before  => Noop["apache/configured"],
}

/usr/bin/mandb: the setuid man user "man" does not exist

by Scott Hebert

I stumbled across this problem when a daily cronjob on one of our Debian servers complained about this. A lot. If you run across this on one of your systems, there is a quick fix.

In our case, it turned out that /usr/bin/mandb could not read /etc/passwd because the mode was 0600 rather than 0644. A quick change (chmod 644 /etc/passwd) and things were back to normal.

Finder Crashing Every Minute

by Scott Hebert

FinderThanks to an error report from one of my backup jobs, I noticed that /Users/slap/Library/Logs/DiagnosticReports was filling up with Finder crash reports (files of the type *.crash). These files were being created once a minute. Additionally, icons on my Desktop were blinking once a minute.

Upon investigation, it seems that Google Drive was the culprit. Specifically, Google Drive's ability to update icons to indicate their sync stats. By disabling the "Show file sync status icons and right click menu" checkbox in Google Drive's Preferences window, I was able to stop the crashing.

OS X CLI: Install VirtualBox

by Scott Hebert

VirtualBoxI decided the other night to begin doing some testing using my headless Mac Mini. I use VirtualBox for all my testing on my Mac OS X systems. Since the Mini is headless, I decided now was as a good a time as any to start using VirtualBox via the command line. Obviously, installing VirtualBox via the command line is not the same as running VirtualBox via the command line, but installing any package from the command line must be practiced to be remembered.

Download the latest package. I'm using wget which you'll only have if you've specifically installed it. I use MacPorts, but Homebrew is another option.

$ wget http://download.virtualbox.org/virtualbox/4.2.12/VirtualBox-4.2.12-84980-OSX.dmg

Mount the disk image (.dmg). The disk image contents will now be mounted on /Volumes/VirtualBox.

$ hdiutil mount VirtualBox-4.2.12-84980-OSX.dmg

Now, install the package. Note that the target is set to /. In addition to installing VirtualBox in /Applications, this will also put the command line tools in /usr/bin.

$ sudo installer -pkg /Volumes/VirtualBox/VirtualBox.pkg -target /

Now unmount the disk image and clean up.

$ hdiutil unmount /Volumes/VirtualBox/
$ rm VirtualBox-4.2.12-84980-OSX.dmg

Download and install the VirtualBox Extension Pack.

$ wget http://download.virtualbox.org/virtualbox/4.2.12/Oracle_VM_VirtualBox_Extension_Pack-4.2.12-84980.vbox-extpack
$ sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.12-84980.vbox-extpack
$ rm Oracle_VM_VirtualBox_Extension_Pack-4.2.12-84980.vbox-extpack