Shell_command cp or mv?

I’m using hassio (SO). I’m tryng execute the command “mv /backup/*.tar /share/”, direct in command or sh file, but both return error: “Error running command: /share/copy_bkp.sh, return code: 1”

Could it be possible that your file copy_bkp.sh is currently in use and therefore cannot be moved?

Not this, it’s a simple bash to copy file from one folder to another. there is no way to stay in use for long.

sorry I mis-wrote my question. It’s not the actual script that would be in use, but the files you’re trying to move.
If they’re in use, you may be able to copy them, but you won’t be able to move them.
also, stupid question, but are you giving the full path to the files? e.g. /home/user/backup instead of /backup or even ~/backup?
If it’s ran by HA, it will require the full path…

1 Like

I’d dont know if you can do it in Hassio, but normally you’d need to give it permission to use cp and mv. something like this:

sudo visudo

then add

hass ALL=(ALL) NOPASSWD:SETENV: /bin/cp
hass ALL=(ALL) NOPASSWD:SETENV: /bin/mv

1 Like

alternatively, although not considered safe, you could try this:
echo "yourpasswordhere" | sudo -S /share/copy_bkp.sh

Yes I’m using full path, in hassio backup and share is in / directory. the files is not in use, If I execute in command line ./copy_bkp.sh work.

Maybe that’s the reason, but I can not execute these commands on hassio.

it is not a permission problem, I have already changed the permissions of the file to 775 and 777 and it did not work.