I am running an rsync script to copy files from a pi to local folder, the script works as intended when run manually but fails with:
: Host key verification failed.
: rsync error: unexplained error (code 255) at rsync.c(703) [Receiver=3.2.3]
When run by a service file, would appreciate any help on where I am going wrong.
script:
#!/bin/bash
experimentNum=$(sshpass -p 'pass' ssh user@IP "cat /source/source.txt")
mkdir -p /dest/$experimentNum
sshpass -p 'pass' rsync -zaP user@IP:/source/ /dest
sshpass -p 'pass' ssh user@IP sudo find /source/ -mtime +14 -daystart -delete
Service:
[Unit]
Description=backup
StartLimitIntervalSec=0
[Service]
Type=oneshot
ExecStart=/usr/bin/bash /absolute-path/drive_backup.sh
Restart=on-failure
RestartSec=5