garethgeorge / backrest

Backrest is a web UI and orchestrator for restic backup.
GNU General Public License v3.0
1.11k stars 37 forks source link

Run Command results should be tracked in the operation log for long running commands #402

Open Gt1ult opened 1 month ago

Gt1ult commented 1 month ago

I have tun the command "check --read-data" in backrest but I cannot see the result as the backup is too big. Is there any way to see the result, unfortunately the command "check --read-data 2>&1 > output.log" is not working in backrest. Thanks

garethgeorge commented 1 month ago

The Run Command UI is a restic only shell (so it doesn't allow for running commands w/bash syntax e.g. piping etc). This is somewhat for simplicity's sake and adds a little security: it's not easily possible to use it as a way to get a general shell on your system (unless there's a bug in restic...).

I've retitled the bug to track making it easy to find logs for custom commands, the output handling is pretty ephemeral right now (really only streamed to the browser in memory, commands running in the background are terminated if the stream dies e.g. by leaving the tab for too long or reloading the page).

The feature is best suited to running quick operations e.g. listing snapshots, retagging them, etc. Slower operations e.g. check, prune, and such should be run using the restic UI at the moment.

Leaving this to track some of the improvements needed to

Since Run Command is largely functional for simple use cases at the moment, it's lower priority than a lot of what's on my plate now but I'll track interest in the feature here.

Gt1ult commented 1 month ago

Thanks so much for taking in consideration the feedback. Your solution are even better to me:

1) Better expose a history of commands run in the UI 2) Support long running commands

garethgeorge commented 3 weeks ago

Implemented https://github.com/garethgeorge/backrest/commit/bb00afa899b17c23f6375a5ee23d3c5354f5df4d as an intermediate term improvement to make cancellation behavior more obvious.