mirror of
https://github.com/ovh/the-bastion.git
synced 2025-02-26 00:24:12 +08:00
fix: scripts: (( )) returns 1 if evaluated to zero
This commit is contained in:
parent
8d0004f8aa
commit
141791db92
2 changed files with 3 additions and 3 deletions
|
@ -19,7 +19,7 @@ while read etimes pid tty
|
|||
do
|
||||
if [ "$tty" = "?" ] && [ "$etimes" -gt 86400 ]; then
|
||||
tokill="$tokill $pid"
|
||||
(( nb++ ))
|
||||
(( ++nb ))
|
||||
fi
|
||||
done < <(ps -C ttyrec -o etimes,pid,tty --no-header)
|
||||
if [ -n "$tokill" ]; then
|
||||
|
@ -37,7 +37,7 @@ do
|
|||
if [ "$tty" = "?" ] && [ "$user" != "root" ] && [ "$etimes" -gt 86400 ]; then
|
||||
if [ "$(ps --no-header --ppid "$pid" | wc -l)" = 0 ]; then
|
||||
tokill="$tokill $pid"
|
||||
(( nb++ ))
|
||||
(( ++nb ))
|
||||
fi
|
||||
fi
|
||||
done < <(ps -C sshd --no-header -o etimes,pid,tty,user)
|
||||
|
|
|
@ -19,7 +19,7 @@ if [ "$1" = "--big-only" ]; then
|
|||
do
|
||||
if echo "$size" | grep -qE '^[0-9]+$' && [ "$size" -gt 100000000 ]; then
|
||||
tokill="$tokill $pid"
|
||||
(( nb++ ))
|
||||
(( ++nb ))
|
||||
fi
|
||||
done < <(lsof -a -n -c ttyrec 2>/dev/null -- /home/ 2>/dev/null)
|
||||
if [ -n "$tokill" ]; then
|
||||
|
|
Loading…
Reference in a new issue