luckman212

API or way to check sync status from commandline / Bash script?

Recommended Posts

I noticed today just by accident that one of my folders was stuck at 100% - sync was not completing for some reason. I had to enable debug mode and found a file that had a weird resource fork for whatever reason was causing the sync to hang. I deleted that file, restarted Sync on both ends and it was green again.

So the question is:  I would like to know if there is any way to get the sync status via command line / Terminal / bash? I would make a periodic script (cron, LaunchAgent on mac etc) to run and if the sync is not complete then maybe pop a notification, send an alert to Pushover etc. Bonus points if the command could output in an easy to parse format such as JSON.

maybe e.g.:

$ rslsync --status [foldername]
{
    "status": [
        {
            "name": "folder1",
            "peer_count": 4,
            "sync_complete": false,
            "unsynced_files": 2,
            "file_count": 4124,
            "total_bytes": 104230636,
            "last_change": 1559231815
        },
        {
            "name": "folder2",
            "peer_count": 3,
            "sync_complete": true,
            "unsynced_files": 0,
            "file_count": 192,
            "total_bytes": 5263463,
            "last_change": 1559215804
        }
    ]
}

(In the above example, last_change represents a timestamp in Unix epoch time)

I see there is (was?) an API but I am not sure if it's supported anymore and I checked the API docs and don't see any method there to query for sync status anyway.

This would be so useful... please

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.