domingo, 29 de abril de 2012

cluster.sh

Para automatizar algunas tareas...

#!/bin/bash
username="cluster"
password="trollFace.its"
uid="998"
echo '>> STEP 1: Attempting to install required packages'
sleep 2
sudo apt-get install openmpi-bin openmpi-common libopenmpi1.3 libopenmpi-dev libmpich1.0-dev libmpich-mpd1.0-dev libmpich-shmem1.0-dev mpich2 mpich2-doc openssh-server build-essential nfs-ker\
nel-server
echo ">> STEP 2: Attempting to create '$username' user"
sleep 2
if id $username > /dev/null 2>&1
then
echo "[!] User already exist..."
else
echo "[!] User doesn't exist, creating... password = $password"
sudo adduser $username --uid $uid
fi
echo "DONE..."
echo ">> STEP 3: Creating ssh keys ..."
sleep 2
echo ">> Enter '$username' password [$password]"
su $username -c "echo -e '\n' | ssh-keygen -t rsa -N ''"
view raw cluster.sh hosted with ❤ by GitHub

1 comentario: