74 lines
2.4 KiB
Markdown
74 lines
2.4 KiB
Markdown
Remote Media Killer
|
|
===============
|
|
|
|
A shell script to make purging remote media files from a Matrix *Synapse* server
|
|
easier.
|
|
|
|
## Dependencies
|
|
|
|
These (or compatible versions) are likely included by default with your chosen
|
|
GNU/Linux system.
|
|
|
|
- Tested with *GNU bash* 5.0.11
|
|
- Requires *GNU date* for date/time conversion
|
|
- Requires *Perl* for domain validation
|
|
- Uses the `_synapse/admin/v1/purge_media_cache` API endpoint
|
|
|
|
## Installation
|
|
|
|
### Downloading directly
|
|
|
|
Go to the [Releases](https://gitbucket.thisisjoes.site/joe/remote_media_killer/releases)
|
|
page and click the link for `rmk.sh` to download the script.
|
|
|
|
### Downloading using *git*
|
|
|
|
Navigate to a reasonable directory and download the repo with `git clone
|
|
https://gitbucket.thisisjoes.site/git/joe/remote_media_killer.git`. This will
|
|
create a directory named `remote_media_killer` automatically.
|
|
|
|
To ensure you run the latest version of the script, first navigate to the
|
|
directory with `cd remote_media_killer`, then switch to the latest version with
|
|
`git checkout 1.0.0`, replacing "1.0.0" with a more recent version if necessary.
|
|
|
|
## Usage
|
|
|
|
### Executing the script
|
|
|
|
You may execute the script directly using *bash* with `bash rmk.sh`.
|
|
|
|
You may also **mark the script as executable** with `chmod +x rmk.sh` and
|
|
execute using this shorthand `./rmk.sh`.
|
|
|
|
#### Making executable from anywhere
|
|
If you don't want to have to navigate to the directory containing the script
|
|
before executing it, you can make it executable from anywhere by first marking
|
|
it as executable (see above), then copying it to an appropriate directory
|
|
`cp -p rmk.sh /usr/bin/local/rmk`. Finally execute the script with `rmk`.
|
|
|
|
### Inputting Information
|
|
|
|
*Remote Media Killer* only takes three variables:
|
|
|
|
1. The FQDN (Domain) of your Matrix Synapse server.
|
|
2. The time/date (Time) of the oldest media you want to keep.
|
|
3. The account token (Token) of a Matrix account with administrative privileges
|
|
on your server.
|
|
|
|
Type each of these variables when prompted and press ***Enter*** to continue.
|
|
The script will return relevant errors if there are any, as well as any output
|
|
from the *Synapse* server.
|
|
|
|
For example, a successful media purge would result in output similar to the
|
|
following:
|
|
|
|
```json
|
|
{
|
|
"deleted": 1337
|
|
}
|
|
```
|
|
|
|
### Common Errors
|
|
|
|
If you encounter an error while using the script you may find a solution on the [Common Errors](https://gitbucket.thisisjoes.site/joe/remote_media_killer/wiki/Common Errors) page.
|