WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: rsync wont start on schedule and boolocal  (Read 1582 times)

Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6966
Re: rsync wont start on schedule and boolocal
« Reply #15 on: July 30, 2019, 09:13:10 PM »
Hi aris
Sorry, my fault. Change this line from:
Code: [Select]
echo -e "\n`date`\n >> /home/tc/rsync.logto:
Code: [Select]
echo -e "\n`date`\n" >> /home/tc/rsync.log

Offline aris

  • WikiUser
  • *
  • Posts: 49
Re: rsync wont start on schedule and boolocal
« Reply #16 on: July 30, 2019, 09:51:21 PM »
Hi Rich,
tried manually and its working
Code: [Select]
cat /home/tc/cpdr33.sh

#!/bin/sh -x
#copy files download an dr 3.3
ifconfig eth0:0 | grep -q "Bcast:" || echo "Network is down" >> /home/tc/rsync.log
rsync -avh -e "ssh -p 2112" root@192.168.3.3:/mnt/sda2/remote_source/ /mnt/sda1/local_destionation >> /home/tc/rsync.log  2>&1 &
tc@box:~$ ./cpdr33.sh
tc@box:~$ cat rsync.log

Wed Jul 31 11:33:01 UTC 2019

receiving incremental file list

sent 20 bytes  received 53 bytes  16.22 bytes/sec

Tried on reboot
Code: [Select]
tc@box:~$ cat /home/tc/rsync.log

Wed Jul 31 11:40:32 UTC 2019

Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(226) [Receiver=3.1.2]

Offline aris

  • WikiUser
  • *
  • Posts: 49
Re: rsync wont start on schedule and boolocal
« Reply #17 on: July 30, 2019, 09:59:21 PM »
So may be its because cron and manual .sh command is run by tc, as well as keypair generation, but bootlocal is run by root, so it doesnt know the key generated key by tc/ doesnt have the file (rsa file generate by tc).

Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6966
Re: rsync wont start on schedule and boolocal
« Reply #18 on: July 30, 2019, 10:09:11 PM »
Hi aris
Try changing this:
Code: [Select]
rsync -avh -e "ssh -p 2112" root@192.168.3.3:/mnt/sda2/remote_source/ /mnt/sda1/local_destionation >> /home/tc/rsync.log  2>&1 &to this:
Code: [Select]
sudo -u tc rsync -avh -e "ssh -p 2112" root@192.168.3.3:/mnt/sda2/remote_source/ /mnt/sda1/local_destionation >> /home/tc/rsync.log  2>&1 &

Offline aris

  • WikiUser
  • *
  • Posts: 49
Re: rsync wont start on schedule and boolocal
« Reply #19 on: July 30, 2019, 10:43:13 PM »
Hi Rich
thats working perfectly...so its sudo -u...thank you very much
this is what I need
Code: [Select]
sudo -u tc rsync -avh -e "ssh -p 2112" root@192.168.3.3:/mnt/sda2/remote_source/ /mnt/sda1/local_destionation >> /home/tc/rsync.log  2>&1 &
tried to specify the key before but still Host key verification failed.
Doesnt matter..
Code: [Select]
rsync -avh -e "ssh -p 2112 -i /home/tc/id_rsa" root@192.168.3.3:/mnt/sda2/remote_source/ /mnt/sda1/local_destionation >> /home/tc/rsync.log  2>&1 &
again thank you..
« Last Edit: July 30, 2019, 10:47:44 PM by aris »

Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6966
Re: rsync wont start on schedule and boolocal
« Reply #20 on: July 30, 2019, 10:46:12 PM »
Hi aris
You're welcome. Glad I could help.