Automated shutdown paranoid edition

One time I relied heavily on the ntfs-3g driver and it killed my ntfs-partition. Since then I always check if any mounted ntfs partition is umounted properly. For automation here is a code snippet for debian (ubuntu?). If a mount point in /media cannot be unmounted there will be no shutdown.

for f in `mount | grep /media/ | awk '{ print $1; }'`;
do 

! umount $f && exit

done

shutdown -h 1

HOWTO: Tell Grub to load windows 7 as default (debian)

… is quite easy if you know what to do (and it’s update safe!):

Will be / Is DEPRECATED. Please refer to: http://www.triggers-world.de/?p=249

Only precondition: win7 or any other OS you want to boot as default is the next OS after the standard debian entries in the grub list / win7 is the only other OS installed

1. Edit /etc/default/grub

#find&edit or add if it doesn't exist
GRUB_DEFAULT=`/bin/bash "/somedir/getlastboot.sh"`

2. in /somedir/ create a getlastboot.sh with the following content

#!/bin/bash

VAR1=`ls -l /boot | grep -v .bak | grep -c initrd.img`
VAR2=`ls -l /boot | grep -v .bak | grep -c vmlinuz`

let DEFAULTX=VAR1+VAR2
echo $DEFAULTX

3. make it executable

chmod 777 getlastboot.sh

4. update-grub

sudo update-grub

(I have not tested it on ubuntu, but it should work there too)