Gitlab is now using https://gitlab.lcsb.uni.lu as it's primary address. Please update your bookmarks. FAQ.

Commit 8bfce757 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

simple manager that allows to install/backup/restore minerva instance

parent 37231136
manager/backup.tar.gz
manager/ssl/
manager/www/
#!/bin/bash
function restore_minerva() {
host=$1
directory=$2
if [ "$host" = "" ]
then
echo "Server not defined"
exit 2
fi
if [ "$directory" = "" ]
then
directory="~/backup/$host/"
fi
echo "Uploading backup $directory/backup.tar.gz"
echo "put -r $directory/backup.tar.gz" | sftp -b - $host
echo "Restoring from backup"
ssh $host "sudo mv backup.tar.gz /opt/backup/"
ssh $host "./minerva-scripts/server/restore.sh"
}
function backup_minerva() {
host=$1
directory=$2
if [ "$host" = "" ]
then
echo "Server not defined"
exit 2
fi
if [ "$directory" = "" ]
then
directory="~/backup/$host/"
fi
echo "Creating backup"
ssh $host "sudo sh /etc/cron.daily/minerva"
ssh $host "sudo mv /opt/backup/backup.tar.gz ."
echo "Downloading backup into $directory"
echo "get -r backup.tar.gz $directory" | sftp -b - $host
}
function install_minerva() {
host=$1
if [ "$host" = "" ]
then
echo "Server not defined"
exit 2
fi
ssh $host "sudo apt-get update; sudo apt-get install -y sudo git"
ssh $host "git clone https://git-r3lab.uni.lu/piotr.gawron/minerva-scripts.git"
ssh $host "sudo ./minerva-scripts/server/create-partition.sh"
ssh $host "sudo ./minerva-scripts/server/install.sh"
}
function install_experimental_minerva() {
host=$1
directory=$2
if [ "$host" = "" ]
then
echo "Server not defined"
exit 2
fi
if [ "$directory" = "" ]
then
directory="~/backup/$host/"
fi
echo "Uploading backup $directory/backup.tar.gz"
echo "put -r $directory/backup.tar.gz" | sftp -b - $host
ssh $host "sudo mv backup.tar.gz /opt/backup/"
ssh $host "sudo apt-get update; sudo apt-get install -y sudo git"
ssh $host "git clone https://git-r3lab.uni.lu/piotr.gawron/minerva-scripts.git"
ssh $host "sudo ./minerva-scripts/server/create-partition.sh"
ssh $host "sudo ./minerva-scripts/server/install-dependencies-only.sh"
ssh $host "sudo ./minerva-scripts/server/restore-experimental.sh"
}
if [ "$1" = "install" ]
then
install_minerva "$2"
elif [ "$1" = "backup" ]
then
backup_minerva "$2" "$3"
elif [ "$1" = "restore" ]
then
restore_minerva "$2" "$3"
elif [ "$1" = "install-experimental" ]
then
install_experimental_minerva "$2" "$3"
else
echo "Unknown command: $1"
echo Available commands:
echo - install HOST_NAME
echo - backup HOST_NAME DIRECTORY
echo - restore HOST_NAME DIRECTORY
exit 1
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment