#!/bin/bash # Copy $SERVER_HOST.acme.json from remote server to dev server if [ "$(id -u)" != "0" ]; then echo -e "\033[31mThis script requires superuser rights.\033[0m" exit 0 fi if [ -z "$1" ]; then echo "Usage: $0 " exit 1 fi SERVER_HOST=$1 REMOTE_USER="root" ACME_FILE="/data/secrets/$SERVER_HOST/letsencrypt/$SERVER_HOST.acme.json" trap 'echo -e "\033[31mSomething went wrong\033[0m"; exit 1' ERR set -e export DEBIAN_FRONTEND=noninteractive scp $REMOTE_USER@$SERVER_HOST:$ACME_FILE $ACME_FILE trap - ERR echo "remote $SERVER_HOST.acme.json copied to local folder"