Updating Puppet on Debian 6

Some missing dependencies stopped Puppet from automatically updating on my systems.Watch Full Movie Online Streaming Online and Download

After some research, I found the proper way to enable Puppet Labs Repos on my installs:

wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb && sudo dpkg -i puppetlabs-release-precise.deb

proceeded byWatch movie online The Lego Batman Movie (2017)

sudo apt-get update && sudo apt-get dist-upgrade -y && sudo apt-get upgrade -y

Will cause everything to be running on the latest version.

Automatically shutdown FreeNAS box when all clients are offline

I’ve been struggling with trying to keep the power consumption of my FreeNAS box to a minimum for quite a while now.

On the past months I also started to play with the Raspberry Pi, running it as a media center device primarely using OpenElec at first and then Raspbmc later on.

I intend to talk about those experiences on a separate posting. At first what concerned me is that for my media center to work I would need to keep my file server running all the time, something that I would not like to do.

My solution comes in two parts:

First to build a device to monitor my lan, pinging known addresses (statically issued by my local DHCP server) and sending a Wake-On-Lan packet when one of them come online.

Second, to keep monitoring my lan, checking every minute if such devices are still present, and if they are not, shut down my file server after 30 minutes.

Now imagine the following scenario: I arrive at home with my phone and laptop. My phone upon seeing my home wifi network will automatically connect. The first raspberry pi will be pinging every minute a list of statically defined addresses looking for a phone or laptop, mine or my wife’s.

Once it receives a response, it sends a WOL packet that will turn my file server on. Now that it is on, the first raspberry pi will only keep pinging the file server, as long as it is on, there is no need for further checks.

On the file server, it would have a script running, pinging another list of addresses. As long as one of them answers, it will do nothing. When all addresses on the list fail to answer on the past 30 minutes it will initiate a shutdown.

And the cycle repeats.

When there is someone at home, the file server will be on, when everyone leaves, it turn itself gracefully off.


Since I have only ONE raspberry pi to do this, I will be turning my file server manually on for the time being and focusing this post on the second part.

This is the script I am using on my FreeNAS box:



keep_on() {
  for p in htpc.home raphael-pc.home sala-tv.home teste.home;
    if ping -c 1 $p >/dev/null 2>&1; then
      return 0
  return 1

# Client must be up before starting main loop
while sleep 5
  if keep_on; then


# main script
while sleep ${CHECK_EVERY}
  if keep_on; then
    echo $FAIL_COUNT
  if [ $FAIL_COUNT == $MAX_FAIL_COUNT ]; then
    shutdown -p now
done 2>&1

Not much complex stuff. The variable CHECK_EVERY state that the checks should be every 60 seconds and MAX_FAIL_COUNT that after 30 fail attempts it will shut itself down.

There is one failsafe: The script will only act when it receives an answer from at least one device on the list. This is to prevent the box to be turning off if something goes wrong with my internal DNS or if I plug it on someone else’s network. You never know…

To allow this to persist between boots, I first made the root writable with

mount -uw /

Then, I saved this script on /conf/base/etc/autoshutdown.sh and added a line calling it on /conf/base/etc/rc.local:



Also, made both scripts executable.

And that is it!

When I get a hold of a second raspberry pi I’ll post the other scripts here as well.

Letting your pool sleep…

Some very good points on an article I just stumbled upon…

Mount all your filesystems/pools with noatime

This way you won’t generate writes every time a file is accessed. I had this suggested by an episode of TechSnap where one of the hosts mentioned that they do this to avoid writes while doing reads but never came back to actually implement it.

I don’t have other filesystems on my FreeNAS box and ZFS has a property for this. Just run:

zfs set atime=off POOLNAME

Find files modified in the last day or so

A good snippet to try to get to these files is:

find / -mtime -1

Relocate directories and files to non-rotating media

Also another great suggestion on the original article:

Get a cheap USB drive (does not need to be big) and format it as ext4 (technically, you could set up another ZFS pool there too). Then, set it to be mounted in `/var/volatile` on your fstab. You can now move directories that contain frequently modified files there. After you’re done moving those directories, you can symlink them from their original location. So, for example, you would move `/var/log` to `/var/volatile/log`, then creating a symbolic link to `/var/volatile/log` named `/var/log`. At this point, it would be wise to make a cron job to nightly back the contents of this USB drive up (think `rsync -a`) to a backups directory somewhere in your pool. OK. If you’ve moved the most frequently modified files to `/var/volatile`, your disks will be idle unless you are actually using your file server. Now it’s time to take advantage of that idleness.