Created
August 23, 2019 17:11
-
-
Save icelander/b0f227c6ff7c6a3f3e4f8ac4bda13c42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Mattermost File Processor Script | |
# | |
# This script allows you to run a Mattermost command against a list of IDs stored in a text file | |
# How to use it | |
# | |
# 1. Get a list of the identifiers for the items you want to process in a text file. More details on the | |
# 2. Get the mattermost command you want to run from https://docs.mattermost.com/administration/command-line-tools.html | |
# 3. Run the script like this to process every line in the file: | |
# $ mattermost_process_file.sh "<Mattermost command>" <path to identifiers file | |
# Examples | |
# Remove many users from a specific channel | |
# - users.txt contains a list of email addresses, usernames, or user IDs | |
# - Mattermost command is "channel remove teamname:channelname" | |
# | |
# $ mattermost_process_file.sh "channel remove teamname:channelname" users.txt | |
# | |
# Notes | |
# If your Mattermost binary is not located at /opt/mattermost/bin/mattermost change the value on line 32 | |
mattermost_cmd=$1 | |
$ids_file=$2 | |
while read id; do | |
/opt/mattermost/bin/mattermost $mattermost_cmd $id; | |
done <$ids_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment