stash
stash copied to clipboard
[Feature] Command line tools for admin tasks
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?).
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.
there is Mutation.backupDatabase check http://localhost:9999/playground for the docs
Anything that can be done via the UI should be able to be done via a script using an http call.
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.