ikifar2012 / remote-backup-addon

Automatically create and backup HA snapshots using SCP
30 stars 4 forks source link

Update run.sh #79

Closed NicLogix closed 1 year ago

NicLogix commented 1 year ago

I think this is a typo or "placeholder" variable (remote) which was never changed to the ${REMOTE_HOST}.

NicLogix commented 1 year ago

Please bear with me. I am by no means an expert on shell or any kind of coding.

The added ssh option I did not intend to push as a pull request, wanted to update local to enable testing only.

Nic du Plessis Logic Services & Consulting 0729871980

On Thu, 17 Nov 2022, 08:53 Patrick, @.***> wrote:

@.**** commented on this pull request.

Please comment why #76 (comment) https://github.com/ikifar2012/remote-backup-addon/issues/76#issuecomment-1316108508 is not a solution for you to better understand what you are trying to achieve.

In remote-backup/run.sh https://github.com/ikifar2012/remote-backup-addon/pull/79#discussion_r1024808995 :

@@ -5,10 +5,12 @@ bashio::config.require "remote_host" "A target host for copying backups is necessary." bashio::config.require "remote_port" "A target host port for communication is necessary." bashio::config.require.username "remote_user" +bashio::config.require "ssh_options"

This is a parameter not necessary for every use, thus should not be required.

In remote-backup/run.sh https://github.com/ikifar2012/remote-backup-addon/pull/79#discussion_r1024811764 :

@@ -162,9 +164,9 @@ function copy-backup-to-remote { fi

 bashio::log.info "Copying backup using SFTP/SCP."
  • if ! sshpass -p "${REMOTE_PASSWORD}" scp -s -F "${SSH_HOME}/config" "/backup/${SLUG}.tar" "${REMOTE_HOST}":"${remote_directory}/${remote_name}.tar"; then
  • if ! sshpass -p "${REMOTE_PASSWORD}" scp "${SSH_OPTIONS}" -s -F "${SSH_HOME}/config" "/backup/${SLUG}.tar" "${REMOTE_HOST}":"${remote_directory}/${remote_name}.tar"; then

This could introduce conflicting options by users which then generate support requests. Overall, I do not really understand how you intend to solve your issue in #76 https://github.com/ikifar2012/remote-backup-addon/issues/76 like this. The keys are loaded from a location specified in the config so overwriting here makes it more complicated. Solution should target the generation of the config, in my opinion.

— Reply to this email directly, view it on GitHub https://github.com/ikifar2012/remote-backup-addon/pull/79#pullrequestreview-1183749289, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3EDC5SC3BAQFYUTCTGEGDWIXJABANCNFSM6AAAAAASC7TM5M . You are receiving this because you authored the thread.Message ID: @.***>

NicLogix commented 1 year ago

Firstly, thank you for the great add-on.

I did manage to create a new id to my server, and the rsync is working great.

In the rsync part, the host is refferred as the variable "${REMOTE_HOST}", but in the ssh part only as "remote".

I cannot see the reference to "remote" anywhere, and thought to help.

Nic du Plessis Logic Services & Consulting 0729871980

On Thu, 17 Nov 2022, 08:43 Patrick, @.***> wrote:

@.**** commented on this pull request.

In remote-backup/run.sh https://github.com/ikifar2012/remote-backup-addon/pull/79#discussion_r1024806941 :

     bashio::log.warning "SFTP transfer failed, falling back to SCP."
  • if ! sshpass -p "${REMOTE_PASSWORD}" scp -O -F "${SSH_HOME}/config" "/backup/${SLUG}.tar" remote:"\"${remote_directory}/${remote_name}.tar\""; then
  • if ! sshpass -p "${REMOTE_PASSWORD}" scp -O -F "${SSH_HOME}/config" "/backup/${SLUG}.tar" "${REMOTE_HOST}":"\"${remote_directory}/${remote_name}.tar\""; then

That change is incorrect, remote refers to the entry in the generated config file!

— Reply to this email directly, view it on GitHub https://github.com/ikifar2012/remote-backup-addon/pull/79#pullrequestreview-1183746408, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3EDCZXKDYI55OA2O35DRDWIXH2LANCNFSM6AAAAAASC7TM5M . You are receiving this because you authored the thread.Message ID: @.***>

patman15 commented 1 year ago

Please bear with me. I am by no means an expert on shell or any kind of coding.

No worries, I'm still trying to help you with your use case. :-)

The added ssh option I did not intend to push as a pull request, wanted to update local to enable testing only.

you can test it locally by copying the addon to the /addons folder and removing the line image: ikifar/remote-backup-{arch} from the config.yaml

In the rsync part, the host is refferred as the variable "${REMOTE_HOST}", but in the ssh part only as "remote".

Yep, you can find the reference in line 82 and it is not a variable but a name.

NicLogix commented 1 year ago

I typed a very long email with debugging logs of the rsync working, and sftp/scp not working.... And as I proofread it, I notice a typo in the ssh path!

Fixed and all working now, both the rsync and ssh. I prefer the rsync, as it copies the config files as well.

Thank you for your help and patience.

I looked at line 82 even though it is working ...

81 echo "Host remote" 82 if bashio::fs.file_exists "${SSH_HOME}/id_rsa"; then 83 echo " IdentityFile ${SSH_HOME}/id_rsa" 84 fi

But do not understand the reference.

Would you please explain where "remote" gets created and translate to the IP? This has me stumped.

Nic du Plessis Logic Services & Consulting 0729871980

Just a bit about myself:

I started with Home Assistant and linux three years ago, and have been programming in basic, pascal, cobol, a bit of c, and now yaml & shell.

It's been a steep learning curve, inbetween learning HP Comware cli, as I got gifted a discontinued A5120 (full L2 & L3 switch). The instructions is 1500 pages!

Lately I have been looking at creating an add-on as I am now doing Hass OS, which limits things. A custom logix addon for myself first would be nice.

Thank you for reading.

On Thu, 17 Nov 2022, 23:36 Patrick, @.***> wrote:

Please bear with me. I am by no means an expert on shell or any kind of coding.

No worries, I'm still trying to help you with your use case. :-)

The added ssh option I did not intend to push as a pull request, wanted to update local to enable testing only.

you can test it locally by copying the addon to the /addons folder and removing the line image: ikifar/remote-backup-{arch} from the config.yaml

In the rsync part, the host is refferred as the variable "${REMOTE_HOST}", but in the ssh part only as "remote".

Yep, you can find the reference in line 82 and it is not a variable but a name.

— Reply to this email directly, view it on GitHub https://github.com/ikifar2012/remote-backup-addon/pull/79#issuecomment-1319235857, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3EDC3P7AI7OFMHN2NED23WI2QMXANCNFSM6AAAAAASC7TM5M . You are receiving this because you authored the thread.Message ID: @.***>

patman15 commented 1 year ago

Would you please explain where "remote" gets created and translate to the IP? This has me stumped.

The function generates an ssh configuration file. Please check the man page for details.

NicLogix commented 1 year ago

I get it now... A smarter way of doing things than what I would have done.

I would jumble everything into a single command, instead of generating a config file and calling that.

Linux is always cooler ;-) I learn every day.

Thank you.

Nic du Plessis Logic Services & Consulting 0729871980

On Sat, 19 Nov 2022, 10:47 Patrick, @.***> wrote:

Would you please explain where "remote" gets created and translate to the IP? This has me stumped.

The function generates an ssh configuration file. Please check the man page https://www.man7.org/linux/man-pages/man5/ssh_config.5.html for details.

— Reply to this email directly, view it on GitHub https://github.com/ikifar2012/remote-backup-addon/pull/79#issuecomment-1320837005, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3EDC3P3C2CE5KPTLN4XVTWJCH3RANCNFSM6AAAAAASC7TM5M . You are receiving this because you authored the thread.Message ID: @.***>

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.