mirror of
https://github.com/hackerschoice/segfault.git
synced 2024-06-20 13:58:39 +00:00
better ban/stop
This commit is contained in:
parent
d81f383aa1
commit
f7bec92c59
@ -6,12 +6,19 @@
|
||||
|
||||
source .env_hosts || exit
|
||||
|
||||
for h in "${HOSTS[@]}"; do
|
||||
echo "Syncing ${h} DOWN"
|
||||
# Reverse order so that first in HOSTS has master priority
|
||||
i=${#HOSTS[@]}
|
||||
while [[ $i -gt 0 ]]; do
|
||||
((i--))
|
||||
h="${HOSTS[$i]}"
|
||||
echo "#${i} Syncing ${h} DOWN"
|
||||
rsync -ral "${h}":/sf/config/db/banned "${h}":/sf/config/db/token "${h}":/sf/config/db/limits .
|
||||
done
|
||||
|
||||
echo "===================================================="
|
||||
i=0
|
||||
for h in "${HOSTS[@]}"; do
|
||||
echo "Syncing ${h} UP"
|
||||
echo "#$i Syncing ${h} UP"
|
||||
rsync -ral banned token limits "${h}":'/sf/config/db'
|
||||
((i++))
|
||||
done
|
@ -108,13 +108,17 @@ _sfcg_forall()
|
||||
local a
|
||||
local ts
|
||||
local fn
|
||||
local skip_token
|
||||
local -
|
||||
|
||||
skip_token="$1"
|
||||
|
||||
set -o noglob
|
||||
IFS=$'\n' arr=($(docker ps --format "{{.Names}}" --filter 'name=^lg-'))
|
||||
|
||||
for l in "${arr[@]}"; do
|
||||
ts=2147483647
|
||||
[[ -n $skip_token ]] && [[ -e "${_sf_dbdir}/user/${l}/token" ]] && continue
|
||||
fn="${_sf_dbdir}/user/${l}/created.txt"
|
||||
[[ -f "$fn" ]] && ts=$(date +%s -u -r "$fn")
|
||||
a+=("$ts $l")
|
||||
@ -528,6 +532,7 @@ lgstop()
|
||||
[[ -n $2 ]] && {
|
||||
lgwall "${1}" "$2"
|
||||
echo -e "$2" >"${_sf_dbdir}/user/${1}/syscop-msg.txt"
|
||||
docker top "$1" -e -o pid,ppid,%cpu,rss,start_time,exe,comm,cmd | cut -c -512 >"${_sf_dbdir}/user/${1}/syscop-ps.txt"
|
||||
}
|
||||
docker stop "${1}"
|
||||
}
|
||||
@ -586,13 +591,15 @@ lgx()
|
||||
{
|
||||
local lglid
|
||||
local match
|
||||
local skip_token
|
||||
local IFS
|
||||
match="$1"
|
||||
skip_token="$2"
|
||||
|
||||
_sf_init
|
||||
[[ -z $match ]] && return
|
||||
|
||||
IFS=$'\n' arr=($(_sfcg_forall))
|
||||
IFS=$'\n' arr=($(_sfcg_forall "$skip_token"))
|
||||
for lglid in "${arr[@]}"; do
|
||||
_sfcg_psarr "$lglid" "$match" >/dev/null && continue
|
||||
echo "$lglid "
|
||||
|
Loading…
Reference in New Issue
Block a user