From 87392bb0d968e8e17925ebc632ee1444c49eac26 Mon Sep 17 00:00:00 2001 From: ray Date: Mon, 8 Jun 2020 21:16:18 +0100 Subject: [PATCH] update --- .gitignore | 2 ++ README.md | 10 ++++++++-- config-example.sh => config-example | 0 config-urls-example | 4 ++++ run.sh | 18 ++++++++++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .gitignore rename config-example.sh => config-example (100%) create mode 100644 config-urls-example create mode 100755 run.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..becc12a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +config +config-urls diff --git a/README.md b/README.md index 511209e..79b355a 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,11 @@ All scripts require an argument to specify 'local' or 'remote'. If none given script will exit. -Scripts that operate on local/remote servers simultaneously (e.g, -`wp-duplicarte.sh`) do not require this argument.sh +Using 'local' will +set the source server URL to `$local_url`. +set the destination server URL to `$remote_url`. + +Using 'remote' will +set the source server URL to `$remote_url`. +set the destination server URL to `$local_url`. + diff --git a/config-example.sh b/config-example similarity index 100% rename from config-example.sh rename to config-example diff --git a/config-urls-example b/config-urls-example new file mode 100644 index 0000000..c16d9ad --- /dev/null +++ b/config-urls-example @@ -0,0 +1,4 @@ +#!/bin/sh + +export local_url='' +export remote_url='' diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..c7120f4 --- /dev/null +++ b/run.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +. ./config-urls + +if [ "$1" = 'local' ] ; then + ( export local_url="$local_url"; \ + export remote_url="$remote_url"; \ + cat config "$2" \ + ) | ssh root@"$local_url" -T /bin/sh +elif [ "$1" = 'remote' ] ; then + ( export local_url="$remote_url"; \ + export remote_url="$local_url"; \ + cat config "$2" \ + ) | ssh root@"$remote_url" -T /bin/sh +else + echo "error: must specify local or remote" +fi +