Created
July 12, 2022 17:22
-
-
Save crpb/bb414090acc4a4db5715c2a4116cad1d 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
## vim: filetype=sh | |
# FARBSPIELE # | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
YELLOW='\033[0;33m' | |
BLUE='\033[0;34m' | |
NC='\033[0m' # No Color | |
function red { printf "${RED}$@${NC}\n" ; } | |
function green { printf "${GREEN}$@${NC}\n" ; } | |
function yellow { printf "${YELLOW}$@${NC}\n" ; } | |
function blue { printf "${BLUE}$@${NC}\n" ; } | |
# Grommunio Konsolen Helferlein | |
# Gromox - Cleanup already deleted files | |
grom_cleanup() { | |
local maildir | |
MESSAGE="\n\n\tTo really cleanup use: "$(blue "grom_cleanup")" "$(red "clean")"\n" | |
SWITCH="-n"; | |
if [[ "$1" = "clean" ]]; then SWITCH="";MESSAGE=""; fi | |
for user in $(grom_users); do | |
yellow "User: ${user}:" | |
maildir="$(grommunio-admin user query --filter username="${user}" maildir)" | |
/usr/libexec/gromox/cleaner "${SWITCH}" -d "${maildir}" |grep --color=always -e "^" -e "[^ ]*[0-9](M|G|k)B" | |
done | |
echo -e "$MESSAGE" | |
} | |
# Grommunio-Users | |
# List Domains | |
grom_doms() { grommunio-admin domain list |awk '{print $2}' ; } | |
# List User | |
grom_users() { | |
local doms | |
if [[ "$#" -ge 1 ]]; then | |
doms=$(grep "^${1}" <<< "$(grom_doms)") | |
else | |
doms=$(grom_doms) | |
fi | |
for dom in $doms; do \ | |
grommunio-admin user query --format json-structured | \ | |
jq -r '.[]|select(.username|endswith("'"${dom}"'"))|.username' | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment