Shell_command: to copy files... fails with `return code: 1`

hi,

i´m using a shell_command to copy log files as desribed 1:1 in this post:

backup_logs: cp /config/home-assistant.log /config/external_data/log-`date +"%Y%m%d%H%M"`.log

what worked like a charm…

i had tried to copy to different target folder backup , but this failed with return code: 1, same error as folder would not exist, but i had created manually and it exists?

for target i had tried a newly created subfolder /backup/hassio-logs first and went on still existing /backup/ folder… but same error?

backup_logs: cp /config/home-assistant.log /backup/hassio-logs/log-`date +"%Y%m%d%H%M"`.log
backup_logs: cp /config/home-assistant.log /backup/log-`date +"%Y%m%d%H%M"`.log

what i made wrong?

br
Frank

Assuming you’re using HAOS, the command will be running under the homeassistant docker container, which cannot see the “/backup” directory. Of the usual folders it can only see “/media”, “/share” and “/config”.

You’ve also got “backup_logs:” twice, which doesn’t look right.

1 Like

thanx @michaelblight
yes you are assuming right, im using hassio… so i will stay on using the config folder for backup, hopefully not to forget to clean it up…

your answer exposes me, that i had not understood docker containers right.(either never used, nor i do know how to setup one) :face_with_hand_over_mouth: Thought containers where i kind of indepentend virtual machines, but surprised seeing more than one container “merged” under one gui… learned something again :+1: