mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
Rsync rewrite test
This commit is contained in:
parent
e3f6925bbf
commit
beb9e8513f
10
ADVANCED.md
10
ADVANCED.md
@ -97,12 +97,12 @@ Gravity Sync will place logs in the same folder as the script (identified as .cr
|
||||
Default setting in Gravity Sync is `$HOME/${LOCAL_FOLDR}`
|
||||
|
||||
#### `SYNCING_LOG=''`
|
||||
Gravity Sync will write a timestamp for any completed pull, push or restore job to this file. If you want to change the name of this file, you will also need to adjust the LOG_PATH variable above, otherwise your file will be remove during `update` operations.
|
||||
Gravity Sync will write a timestamp for any completed pull, push or restore job to this file. If you want to change the name of this file, you will also need to adjust the LOG_PATH variable above, otherwise your file will be remove during an `update` operations.
|
||||
|
||||
Default setting in Gravity Sync is `gravity-sync.log`
|
||||
|
||||
#### `CRONJOB_LOG=''`
|
||||
Gravity Sync will log the execution history of the previous automation task via Cron to this file. If you want to change the name of this file, you will also need to adjust the LOG_PATH variable above, otherwise your file will be remove during `update` operations.
|
||||
Gravity Sync will log the execution history of the previous automation task via Cron to this file. If you want to change the name of this file, you will also need to adjust the LOG_PATH variable above, otherwise your file will be remove during an `update` operations.
|
||||
|
||||
This will have an impact to both the `./gravity-sync.sh automate` function and the `./gravity-sync.sh cron` functions. If you need to change this after running the automate function, either modify your crontab manually or delete the entry and re-run the automate function.
|
||||
|
||||
@ -175,9 +175,3 @@ If you prefer to still use cron but modify your settings by hand, using the entr
|
||||
crontab -e
|
||||
*/30 * * * * /bin/bash /home/USER/gravity-sync/gravity-sync.sh pull > /home/USER/gravity-sync/gravity-sync.cron
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- If it doesn't kick off, you can manually execute a `git pull` while in the `gravity-sync` directory.
|
||||
|
||||
If all else fails, delete the entire `gravity-sync` folder from your system and re-deploy. This will have no impact on your replicated databases.
|
||||
|
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,12 +1,5 @@
|
||||
# The Changelog
|
||||
|
||||
## 1.8
|
||||
### The Logical Release
|
||||
|
||||
- All of the SSH connection logic has been rewritten to be specific to client options between OpenSSH, OpenSSH w/ SSHPASS, and Dropbear.
|
||||
- Removes INFO that SSHPASS is not installed during config, if it's not needed. Redirects user to documentation.
|
||||
- Better error handling of configuration options.
|
||||
|
||||
## 1.7
|
||||
### The Andrew Release
|
||||
|
||||
@ -18,6 +11,11 @@
|
||||
**Known Issues**
|
||||
- No new Star Trek references.
|
||||
|
||||
#### 1.7.8
|
||||
- SSH connection logic rewritten to be specific to client options between OpenSSH, OpenSSH w/ SSHPASS, and Dropbear.
|
||||
- Removes INFO that SSHPASS is not installed during config, if it's not needed. Redirects user to documentation.
|
||||
- Better error handling of configuration options.
|
||||
|
||||
#### 1.7.7
|
||||
- `config` function will attempt to ping remote host to validate network connection, can by bypassed by adding `PING_AVOID='1'` to your `gravity-sync.conf` file.
|
||||
- Changes some [INFO] messages to [WARN] where approprate.
|
||||
|
@ -150,8 +150,14 @@ function pull_gs {
|
||||
|
||||
MESSAGE="Pulling ${GRAVITY_FI} from ${REMOTE_HOST}"
|
||||
echo_stat
|
||||
${SSHPASSWORD} rsync -e "${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull >/dev/null 2>&1
|
||||
error_validate
|
||||
RSYNC_SOURCE="${PIHOLE_DIR}/${GRAVITY_FI}"
|
||||
RSYNC_TARGET="$HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull"
|
||||
create_rsynccmd
|
||||
${RSYNC_SEND} >/dev/null 2>&1
|
||||
error_validate
|
||||
|
||||
#${SSHPASSWORD} rsync -e "${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull >/dev/null 2>&1
|
||||
#error_validate
|
||||
|
||||
MESSAGE="Replacing ${GRAVITY_FI} on $HOSTNAME"
|
||||
echo_stat
|
||||
@ -596,7 +602,7 @@ function validate_os_sshpass {
|
||||
echo_info
|
||||
else
|
||||
MESSAGE="Testing Authentication Options"
|
||||
echo_info
|
||||
echo_stat
|
||||
|
||||
timeout 5 ssh -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
|
||||
if [ "$?" != "0" ]
|
||||
@ -620,30 +626,13 @@ function validate_os_sshpass {
|
||||
|
||||
CMD_TIMEOUT='5'
|
||||
CMD_REQUESTED="exit"
|
||||
ssh_function
|
||||
#echo -en "${SSH_SEND}"
|
||||
${SSH_SEND} #>/dev/null 2>&1
|
||||
create_sshcmd
|
||||
${SSH_SEND} >/dev/null 2>&1
|
||||
error_validate
|
||||
|
||||
# if hash ssh 2>/dev/null
|
||||
# then
|
||||
# if [ -z "$SSHPASSWORD" ]
|
||||
# then
|
||||
# timeout 5 ${SSH_CMD} -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
|
||||
# error_validate
|
||||
# else
|
||||
# timeout 5 ${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
|
||||
# error_validate
|
||||
# fi
|
||||
# elif hash dbclient 2>/dev/null
|
||||
# then
|
||||
# timeout 5 ${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
|
||||
# error_validate
|
||||
# fi
|
||||
}
|
||||
|
||||
## Determine SSH Pathways
|
||||
function ssh_function {
|
||||
function create_sshcmd {
|
||||
if hash ssh 2>/dev/null
|
||||
then
|
||||
if [ -z "$SSHPASSWORD" ]
|
||||
@ -654,7 +643,23 @@ function ssh_function {
|
||||
fi
|
||||
elif hash dbclient 2>/dev/null
|
||||
then
|
||||
SSH_SEND="timeout --preserve-status ${CMD_TIMEOUT} ${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF} ${REMOTE_USER}@${REMOTE_HOST} \"${CMD_REQUESTED}\""
|
||||
SSH_SEND="timeout --preserve-status ${CMD_TIMEOUT} ${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF} ${REMOTE_USER}@${REMOTE_HOST} \"${CMD_REQUESTED}\""
|
||||
fi
|
||||
}
|
||||
|
||||
## Determine SSH Pathways
|
||||
function create_rsynccmd {
|
||||
if hash ssh 2>/dev/null
|
||||
then
|
||||
if [ -z "$SSHPASSWORD" ]
|
||||
then
|
||||
RSYNC_SEND="rsync -e "${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${RSYNC_SOURCE} ${RSYNC_TARGET}"
|
||||
else
|
||||
RSYNC_SEND="rsync -e "${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${RSYNC_SOURCE} ${RSYNC_TARGET}"
|
||||
fi
|
||||
elif hash dbclient 2>/dev/null
|
||||
then
|
||||
RSYNC_SEND="rsync -e "${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${RSYNC_SOURCE} ${RSYNC_TARGET}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user