Any way to pause a task and then restart within a pipe

tm flag

I use a command like btrfs restore -iv /dev/sdc1 /RESTORED

estimated time of running it is few days

In every hour of running I see a lot of prompts like:

We seem to be looping a lot on /path/to/some/file, do you want to keep going on?

I'd like to say N to all remaining prompts, but there is no such option (according to man btrfs-restore and btrfs )

I think I need this: yes N | btrfs restore -iv /dev/sdc1 /RESTORED (which will start restore again)

Is any way to pause a running task (not cancel) and then resume within a pipe like

ctrl+Z + $ yes N | fg

(the above return fg no job control). fg here is only to show what I mean.

vanadium avatar
cn flag
Interesting question, but I don't think it is possible to redirect standard input on the fly. One work around could be to use `xdotool` or `xvkbd` to simulate repeatedly pressing N. A script doing that could be launched with a shortcut key when the command is running and starts to ask confirmations.
muru avatar
us flag
This is really a job for `expect`.
tm flag

I found a workaround like this:

simply I generated a list of N (for example by yes N)

copied that and paste into running task

It is of course limited, so in my case, I've copied 10K lines of N.

the list must be with a single N per line.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.