davidem

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by davidem

  1. Perhaps my respons is a bit late, but I agree it would have been nice if Resilio Sync had a status options. But... it is possible to get the overall sync status. In .config/resilio-sync/storage/ there's a file called 'sync.log', where among a lot of noise the sync status is kept. I say noise, because I have no interest is 99% of the file. With the following ugly command (I'm normally no fan of "grep|awk|tail|awk", but hey, it works) I get the latest status, to see if syncing is done and to decide if I can shutdown my raspbery pi dashcam 😎 grep -Pzo '.*'"`date --date="-2 min" "+%Y%m%d %H:%M"`"'(.*\n)*' /home/pi/.config/resilio-sync/storage/sync.log | awk '/ScheduledTask/&&!/ConnectMorePeers/&&!/ExpireFailedDownloads/'| tail -n 1 |awk -F ":" '/UpdatePeersStat/{print $NF}' My script runs every 2 minutes, so I'm only interested in status changes within the last 2 minutes. If the output is "FinishStateSync", syncing is finished. Anything else means it is still not 100% done. I hope this helps, even after all this time
  2. I think I've figured it out... I stumbled on some strange behaviour of sync.log. Awk or a normal grep can't open the file sometimes. Awk replies nothing, grep replies "Binary file (standard input) matches". 🤔 I now know why my script was behaving erratically. Using 'grep -a' circumvents this, I haven't found an awk equivalent yet. This enables me to sift through the output of the last five minutes. I can now quickly search for "ScheduledTask" messages. If the last one ends with "FinishStateSync", I assume Resilio sync is done and I can safely shutdown the Raspberry pi. Here's the code, but bear in mind the code is quite fugly 😎 Haven't had the time yet to turn it into a nice oneliner. Sorry for that... resilio_status=$(grep -Pzo '.*'"`date --date="-5 min" "+%Y%m%d %H:%M"`"'(.*\n)*' sync.log | awk '/ScheduledTask/&&!/ConnectMorePeers/'| tail -n 1 | awk -F ":" '/UpdatePeersStat/{print $NF}') if [[ $resilio_status = 'FinishStateSync' ]];then # if so: write status, shutdown pi _pistatus | sudo tee ${report_dir}/pi_report_$(date +%FT%T) sleep 20 _shutpi else echo " Resilio not yet finised" fi If anyone has a better idea, don't hesitate to spam me 😁
  3. Hi all, I just finished building my own dashcam with a Raspberry Pi. When I turn of the car at home, the Pi continues to run on own UPS and tries to connect to my wifi network. When connected, Resilio Sync (home edition) will sync the video folder to my NAS. When the sync is done, the Pi should be turned of. Question is: how can I check from the Linux CLI if the sync is 100%? I noticed a log-entry in the sync.log with "UpdatePeersStat" and "FinishStateSync", but unfortunately looking for that entry doens't always work. Thanks in advance! (ps. I've searched for this issue on the forum, but couldn't find an earlier question regarding this. If this is a duplicate question, mea culpa )