public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Trace
helper-scripts/reset-learns.sh
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
#!/usr/bin/env bash
3
read -r -p "Are you sure you want to reset learned hashes from Rspamd (fuzzy, bayes, neural)? [y/N] " response
4
response=${response,,} # tolower
5
if [[ "$response" =~ ^(yes|y)$ ]]; then
6
echo "Working, please wait..."
7
REDIS_ID=$(docker ps -qf name=redis-mailcow)
8
RSPAMD_ID=$(docker ps -qf name=rspamd-mailcow)
10
if [ -z ${REDIS_ID} ] || [ -z ${RSPAMD_ID} ]; then
11
echo "Cannot determine Redis or Rspamd container ID"
12
exit 1
13
else
14
echo "Stopping Rspamd container"
15
docker stop ${RSPAMD_ID}
16
echo "LUA will return nil when it succeeds or print a warning/error when it fails."
17
echo "Deleting all RS* keys - if any"
18
docker exec -it ${REDIS_ID} redis-cli -a ${REDISPASS} --no-auth-warning EVAL "for _,k in ipairs(redis.call('keys', ARGV[1])) do redis.call('del', k) end" 0 'RS*'
19
echo "Deleting all BAYES* keys - if any"
20
docker exec -it ${REDIS_ID} redis-cli -a ${REDISPASS} --no-auth-warning EVAL "for _,k in ipairs(redis.call('keys', ARGV[1])) do redis.call('del', k) end" 0 'BAYES*'
21
echo "Deleting all learned* keys - if any"
22
docker exec -it ${REDIS_ID} redis-cli -a ${REDISPASS} --no-auth-warning EVAL "for _,k in ipairs(redis.call('keys', ARGV[1])) do redis.call('del', k) end" 0 'learned*'
23
echo "Deleting all fuzzy* keys - if any"
24
docker exec -it ${REDIS_ID} redis-cli -a ${REDISPASS} --no-auth-warning EVAL "for _,k in ipairs(redis.call('keys', ARGV[1])) do redis.call('del', k) end" 0 'fuzzy*'
25
echo "Deleting all tRFANN* keys - if any"
26
docker exec -it ${REDIS_ID} redis-cli -a ${REDISPASS} --no-auth-warning EVAL "for _,k in ipairs(redis.call('keys', ARGV[1])) do redis.call('del', k) end" 0 'tRFANN*'
27
echo "Starting Rspamd container"
28
docker start ${RSPAMD_ID}
29
fi
30
fi