diff --git a/rsync-backup-target/resources/bin/compose-add-rsync-key b/rsync-backup-target/resources/bin/compose-add-rsync-key index dbd8acfc..afe19d96 100755 --- a/rsync-backup-target/resources/bin/compose-add-rsync-key +++ b/rsync-backup-target/resources/bin/compose-add-rsync-key @@ -43,22 +43,24 @@ check_valid_yaml() { cmdline.spec.gnu cmdline.spec.reporting -service_name=${SERVICE_NAME:-rsync-backup-target} -compose_file=${COMPOSE_FILE:-/etc/compose/compose.yml} -cmdline.spec::valued:--compose-file,-f:usage() { - echo "Compose file location. Defaults to '/etc/compose/compose.yml'"; } -cmdline.spec::valued:--compose-file,-f:run() { compose_file="$1"; } - -cmdline.spec::valued:--service-name,-s:usage() { - echo "YAML service name in compose file to check for existence of key. Defaults to 'rsync-backup-target'"; } -cmdline.spec::valued:--service-name,-s:run() { service_name="$1"; } cmdline.spec::cmd:__main__:run() { : :posarg: DOMAIN 'domain identifier' : :posarg: SSH_PUBLIC_KEY 'ssh public key' + : :optfla: --no-reload,-R 'Prevent reloading archiving server' + + : :optval: --service-name,-s "YAML service name in compose + file to check for existence of key. + Defaults to 'rsync-backup-target'" + : :optval: --compose-file,-f "Compose file location. Defaults to + '/etc/compose/compose.yml'" + + local service_name compose_file + service_name=${opt_service_name:-rsync-backup-target} + compose_file=${opt_compose_file:-/etc/compose/compose.yml} if ! existing_domains=$(shyaml keys "${service_name//./\\.}.options.keys" < "$compose_file"); then err "Couldn't query file '$compose_file' for keys of" \ "service ${DARKYELLOW}${service_name}${NORMAL}." @@ -128,9 +130,10 @@ EOF cp "$compose_file" "${compose_file}.old" echo "$content" > "$compose_file" - ## reloading (could be much faster) - compose --debug down && compose --debug up - + if [ -z "$opt_no_reload" ]; then + ## reloading (could be much faster) + compose --debug down && compose --debug up + fi if [ "$?" == 0 ]; then echo "Added key, and restarted service ${DARKYELLOW}$service_name${NORMAL}." else