HOWTO: Resume via CLI


(Paul Littlefield) #1

How do I Resume a Paused Device or Paused Folder via the Linux command line?


(Audrius Butkevicius) #2

The pausedness is set in the config.


(Paul Littlefield) #3

That does not answer my question directly.

It’s probably my fault and I apologise for the confusion.

Let me clarify…

“In the web gui, I have pressed the [Pause] button for a Remote Device, and I would like to [Resume] this late tonight when I am asleep using a simple command line in Linux with the at or cron daemon.”

That better?


(Audrius Butkevicius) #4

You’d have to write something that does that, as in, gets the config in json format, unsets the pauses and posts it back. There is no one liner that would do that. You could maybe kill syncthing and restart it with -unpause argument.


(Simon) #5

For devices you can do it via the REST Api.

You can use

curl -X POST -H "X-API-Key: abc123" http://localhost:8384/rest/system/resume?device=device-id

Replacing device-id with the actual device ID of the paused device.


(Jakob Borg) #6

For other things, even though the config is JSON you don’t need to actually parse JSON to do this if you don’t want to. Here’s a completely untested unpauseall.sh that I just typed into the forum, no guarantees:

#!/bin/bash
set -euo pipefail

f=$(mktemp)
function clean {
  rm -f "$f"
}
trap clean EXIT

curl -s -H X-API-Key:yourapikey http://localhost:8384/rest/system/config \
  | sed 's/"paused":true/"paused":false/' \
  > "$f"

curl -s -H X-API-Key:yourapikey --data/binary @"$f" \
  http://localhost:8384/rest/system/config


(Paul Littlefield) #7

Thank you to all for the replies.

I shall try those out tonight!

:slight_smile:

Paully


(Paul Littlefield) #8

I couldn’t wait to try it out before tonight :-), so I grabed the API Key via the GUI, then ran the curl command, and yes, it worked…

…after a brief ‘Disconnected’ time, it ‘Connected’ and started ‘Syncing’.

All lset for tonight then.

Nice one, many thanks!


(system) #9

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.