nyxi

Notepad about Linux stuff mostly.

Compiling Mpdas

I’ve started using mpd as my primary music player and I want to scrobble my tracks to last.fm, enter mpdas a audioscrobble for mpd. Let’s compile it from source in Debian Wheezy:

Compiling Mpv in Wheezy

I ran across mpv earlier today, it’s a fork of mplayer2 which appears to focus on cleaning up the codebase and adding new features. I decided I wanted to give it a try and followed the documentation on the Github page on how to compile it in Debian.

Compile MPD and MPC

Want the latest version of Music Player Daemon and Music Player Client in Debian? Read on for a guide on how to compile and install them yourself.

Raspbian Libcec

We are going to compile libcec on a Raspberry Pi with Raspbian.

Install the necessary tools for compiling:

1
apt-get install build-essential autoconf liblockdev1-dev libudev-dev git libtool pkg-config

Cronjob, Mail on Error in Script

Scheduling your scripts with cron is incredibly common, and most of the time you only want to be notified when a script has exited with errors. Here is a simply example that will email all output from cron to the specified email address:

1
2
MAILTO="script-admins@example.com"
0 4 * * * USER /path/to/script/executable 2>&1 > /var/log/script.log || cat /var/log/script.log

Puppet With Passenger

This guide will show you how to set up a Puppetmaster-server with Puppet v3.0.1 in Debian 6 Squeeze. I did this in a virtual machine using hostname of the server as the address for the client (had to edit the client’s /etc/hosts and add IP+hostname of the server).

Reinstall GRUB

One of my machines didn’t want to boot after I installed a ton of updates, tried sorting out the GRUB config but just couldn’t get the machine to boot. In scenarios like this the easy thing to do is to grab a live cd of Ubuntu or whatever distribution floats your boat and then reinstall GRUB. From command line:

1
mount /dev/sda1 /mnt

Replace /dev/sda1 with whatever hard drive you have (the same one GRUB is failing to boot from).

1
grub-install /dev/sda1 --root-directory=/mnt

Again, replace /dev/sda1 with your hard drive.

1
shutdown -r now

Reboot and you should hopefully have a working boot loader.

Find Word in Files

To search a single file for a word/phrase:

1
grep "tacos" /var/www/index.html

To search in all files in a directory plus it’s subdirectories use:

1
grep -r "tacos" /var/www

Cronjob on Boot

Start the crontab editor:

1
crontab -e

And add the following line:

1
@reboot /path/to/binary