I created a script that backs up the selected folder to a remote server using rsync. Everything works fine when I manually run the script. But I would like it to be done automatically when the system shuts down. And this is where I get an error:
 13:19:12 mx rsync_update.sh[9512]: Host key verification failed.
 13:19:12 mx rsync_update.sh[9506]: rsync: connection unexpectedly closed (0 bytes received so far) [sender]
 13:19:12 mx rsync_update.sh[9506]: rsync error: unexplained error (code 255) at io.c(231) [sender=3.2.7]
The unit looks like this
[Unit]
Description=Clean on reboot,shutdown
Requires=network.targe rsync.service 
After=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecStop=/usr/local/bin/rsync_backup.sh
[Install]
WantedBy=multi-user.target
Rsync works via ssh.
 
                