stash icon indicating copy to clipboard operation
stash copied to clipboard

[Feature] Command line tools for admin tasks

Open stashTX opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. An interactive user is required to kick off any of the items in the "Tasks" menu. Sometimes it would be nice to have these happen automatically.

Describe the solution you'd like I would like to see a command line tool built in where one could setup a cron job for tasks like scanning for new media, generating content and backing up the database.

Describe alternatives you've considered I'm sure one could do this by issuing a properly crafted curl command against the running instance. I suppose it would be acceptable if there was a well documented way to do these things with an API call (or is there one that I'm missing?).

stashTX avatar Sep 05 '22 01:09 stashTX

Ah. I see after looking through the API docs that some of these should be doable.

I guess the one I do not see listed is running the database backup. This could likely be scraped from the web interface (I may test this). If so the documentation could be improved here.

stashTX avatar Sep 05 '22 06:09 stashTX

there is Mutation.backupDatabase check http://localhost:9999/playground for the docs

MrX292 avatar Sep 05 '22 15:09 MrX292

Anything that can be done via the UI should be able to be done via a script using an http call.

WithoutPants avatar Oct 06 '22 05:10 WithoutPants

If anyone else stumbles over this issue wondering how to do an backup via cron/curl. Here is the command:

curl --cookie cookie.txt -H "Content-Type: application/json" --data '{ "query": "mutation { backupDatabase ( input: {download:true} ) }"}' [IP]:[Port]/graphql

For this to work you have to use the API with cookies. It probably would work with the API Key asswell but i can't test it. Maybe someone can add this command to the Wiki, because i can't edit the site.

Maxklos avatar Dec 24 '22 10:12 Maxklos