diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2017-12-04 13:25:44 +0100 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2017-12-04 13:26:36 +0100 |
commit | 64f6dfeb7f7b07a91cc8fee8005ae0bc12a96e25 (patch) | |
tree | ebfa77af8271cdd6af4a395bf938351293803d1f /deploy.sh | |
parent | 12a4f0f44958a4a321e5314e3f6248de1139b6d0 (diff) |
Added dokumentation for tests, gitlab and deployments
Diffstat (limited to 'deploy.sh')
-rwxr-xr-x | deploy.sh | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -6,9 +6,24 @@ remote_host= remote_path= deploy_id= -while getopts ":h:p:i:" opt; do +show_help(){ + echo "Usage: $0 [OPTION]..." >&2 + echo "Deploys a software with rsync over ssh" >&2 + echo "The options -i, -p and -r are required" >&2 + echo "" >&2 + echo " -h Display this help screen" >&2 + echo " -i <id> Sets the id, a unique name for the deployment" >&2 + echo " -p <path> Define the base path on the server" >&2 + echo " -r <host> The remote server name and user" >&2 +} + +while getopts ":hi:p:r:" opt; do case ${opt} in h) + show_help + exit 1 + ;; + r) remote_host="$OPTARG" ;; p) @@ -29,7 +44,7 @@ while getopts ":h:p:i:" opt; do done if [ -z "${remote_host}" ] || [ -z "${remote_path}" ] || [ -z "${deploy_id}" ]; then - echo "Please specify -h[remote host], -p[remote path] and -i[deploy id]" >&2 + show_help exit 1 fi @@ -48,8 +63,7 @@ ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "${remote_hos fi echo \"Changing symlink\" - unlink \"${remote_path}/current\" - ln -s \"${remote_path}/${deploy_id}\" \"${remote_path}/current\" + unlink \"${remote_path}/current\" && ln -s \"${remote_path}/${deploy_id}\" \"${remote_path}/current\" if [[ -f \"${deploy_id}-config.php\" ]]; then echo \"Restoring config\" |