#!/bin/bash SERVER=$1 PLAYBOOK=$2 SITE_NAME=$3 DOMAIN_NAME=$4 while [[ "$#" -gt 0 ]]; do case $1 in -f|--force) force=1; shift ;; esac shift done usage() { echo "Usage: run-vps-playbook.sh server playbook site_name domain_name" echo "server - domain or ip address of the vps server" echo "playbook - playbook file" echo "site_name - site name, e.g. intermetiz - that is a project name used for create home directory and www directory, and database dump base file name" echo "domain_name - domain name, e.g. intermetiz.ru" } if [[ -z "$SERVER" ]]; then echo "You must defined SERVER as first argument" usage exit 1 fi if [[ -z "$PLAYBOOK" ]]; then echo "You must defined PLAYBOOK as second argument" usage exit 1 fi if [[ -z "$SITE_NAME" ]]; then echo "You must defined SITE_NAME as third argument" usage exit 1 fi if [[ -z "$DOMAIN_NAME" ]]; then echo "You must defined DOMAIN_NAME as fourth argument" usage exit 1 fi if [[ ! -f "$PLAYBOOK" ]]; then echo "Playbook file is not exists: $PLAYBOOK" usage exit 1 fi COMMAND=$(cat <