Friday, November 16, 2007

check-swap.sh

#!/bin/bash
if grep -q "/swap" /etc/fstab
then
echo "Encontrado"
else
echo "Añadiendo"
echo '/swap swap swap defaults 0 0' >> /etc/fstab
mount -a
fi

Añadir Swap

for i in `qhost | grep -v -- \-\ | grep 996.2M | awk '{print $1}'`; do ssh -x $i " dd if=/dev/zero of=/swapfile count=2M ; mkswap /swapfile; swapon /swapfile"; done