hi folks,
I’ve got 2 directories which I’m trying to clean up by using a shell script service call.
Here are the 2 calls:
clean_up_backup_files: '/usr/bin/find /backup/ -type f -mtime +10 -delete'
clean_up_mpv_files: '/usr/bin/find /share/motioneye/ -type f -mtime +10 -delete'
The first call errors with no directory found.
The second call works as expected out-of-the box, and cleans the correctly found files away.
Here are the directories:
~ $ ls -ld /backup/ /config/ /share/motioneye/
drwxr-xr-x 2 root root 4096 Dec 11 09:47 /backup/
drwxr-xr-x 11 root root 4096 Dec 11 12:46 /config/
drwxr-xr-x 9 root root 4096 Dec 11 09:41 /share/motioneye/
~ $
This is the error in the log file:
2022-12-11 12:48:00.321 DEBUG (MainThread) [homeassistant.components.shell_command] Stderr of command: `/usr/bin/find /backup/ -type f -mtime +10 -delete`, return code: 1:
b'find: /backup/: No such file or directory\n'
2022-12-11 12:48:00.322 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `/usr/bin/find /backup/ -type f -mtime +10 -delete`, return code: 1
NoneType: None
It’s not clear to me how 2 virtually identical calls in virtually identical contexts are creating such a difference in behaviour. Maybe I’m missing something obvious?
I’m using:
Home Assistant 2022.12.1
Supervisor 2022.11.2
Operating System 9.3
Frontend 20221208.0 - latest